mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-12 15:24:00 +08:00
ipv4: add __ip_queue_xmit() that supports tos param
This patch introduces __ip_queue_xmit(), through which the callers can pass tos param into it without having to set inet->tos. For ipv6, ip6_xmit() already allows passing tclass parameter. It's needed when some transport protocol doesn't use inet->tos, like sctp's per transport dscp, which will be added in next patch. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
05bd97fc55
commit
69b9e1e07d
@ -148,7 +148,8 @@ void ip_send_check(struct iphdr *ip);
|
||||
int __ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
|
||||
int ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
|
||||
|
||||
int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl);
|
||||
int __ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
|
||||
__u8 tos);
|
||||
void ip_init(void);
|
||||
int ip_append_data(struct sock *sk, struct flowi4 *fl4,
|
||||
int getfrag(void *from, char *to, int offset, int len,
|
||||
@ -174,6 +175,12 @@ struct sk_buff *ip_make_skb(struct sock *sk, struct flowi4 *fl4,
|
||||
struct ipcm_cookie *ipc, struct rtable **rtp,
|
||||
struct inet_cork *cork, unsigned int flags);
|
||||
|
||||
static inline int ip_queue_xmit(struct sock *sk, struct sk_buff *skb,
|
||||
struct flowi *fl)
|
||||
{
|
||||
return __ip_queue_xmit(sk, skb, fl, inet_sk(sk)->tos);
|
||||
}
|
||||
|
||||
static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4)
|
||||
{
|
||||
return __ip_make_skb(sk, fl4, &sk->sk_write_queue, &inet_sk(sk)->cork.base);
|
||||
|
@ -423,7 +423,8 @@ static void ip_copy_addrs(struct iphdr *iph, const struct flowi4 *fl4)
|
||||
}
|
||||
|
||||
/* Note: skb->sk can be different from sk, in case of tunnels */
|
||||
int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl)
|
||||
int __ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
|
||||
__u8 tos)
|
||||
{
|
||||
struct inet_sock *inet = inet_sk(sk);
|
||||
struct net *net = sock_net(sk);
|
||||
@ -462,7 +463,7 @@ int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl)
|
||||
inet->inet_dport,
|
||||
inet->inet_sport,
|
||||
sk->sk_protocol,
|
||||
RT_CONN_FLAGS(sk),
|
||||
RT_CONN_FLAGS_TOS(sk, tos),
|
||||
sk->sk_bound_dev_if);
|
||||
if (IS_ERR(rt))
|
||||
goto no_route;
|
||||
@ -478,7 +479,7 @@ packet_routed:
|
||||
skb_push(skb, sizeof(struct iphdr) + (inet_opt ? inet_opt->opt.optlen : 0));
|
||||
skb_reset_network_header(skb);
|
||||
iph = ip_hdr(skb);
|
||||
*((__be16 *)iph) = htons((4 << 12) | (5 << 8) | (inet->tos & 0xff));
|
||||
*((__be16 *)iph) = htons((4 << 12) | (5 << 8) | (tos & 0xff));
|
||||
if (ip_dont_fragment(sk, &rt->dst) && !skb->ignore_df)
|
||||
iph->frag_off = htons(IP_DF);
|
||||
else
|
||||
@ -511,7 +512,7 @@ no_route:
|
||||
kfree_skb(skb);
|
||||
return -EHOSTUNREACH;
|
||||
}
|
||||
EXPORT_SYMBOL(ip_queue_xmit);
|
||||
EXPORT_SYMBOL(__ip_queue_xmit);
|
||||
|
||||
static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user