diff options
Diffstat (limited to 'include/net/ip.h')
-rw-r--r-- | include/net/ip.h | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/include/net/ip.h b/include/net/ip.h index 9b9ca2839399..1a98f1ca1638 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -100,24 +100,20 @@ int igmp_mc_init(void); | |||
100 | * Functions provided by ip.c | 100 | * Functions provided by ip.c |
101 | */ | 101 | */ |
102 | 102 | ||
103 | int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, | 103 | int ip_build_and_send_pkt(struct sk_buff *skb, const struct sock *sk, |
104 | __be32 saddr, __be32 daddr, | 104 | __be32 saddr, __be32 daddr, |
105 | struct ip_options_rcu *opt); | 105 | struct ip_options_rcu *opt); |
106 | int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, | 106 | int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, |
107 | struct net_device *orig_dev); | 107 | struct net_device *orig_dev); |
108 | int ip_local_deliver(struct sk_buff *skb); | 108 | int ip_local_deliver(struct sk_buff *skb); |
109 | int ip_mr_input(struct sk_buff *skb); | 109 | int ip_mr_input(struct sk_buff *skb); |
110 | int ip_output(struct sock *sk, struct sk_buff *skb); | 110 | int ip_output(struct net *net, struct sock *sk, struct sk_buff *skb); |
111 | int ip_mc_output(struct sock *sk, struct sk_buff *skb); | 111 | int ip_mc_output(struct net *net, struct sock *sk, struct sk_buff *skb); |
112 | int ip_do_fragment(struct sock *sk, struct sk_buff *skb, | 112 | int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, |
113 | int (*output)(struct sock *, struct sk_buff *)); | 113 | int (*output)(struct net *, struct sock *, struct sk_buff *)); |
114 | void ip_send_check(struct iphdr *ip); | 114 | void ip_send_check(struct iphdr *ip); |
115 | int __ip_local_out(struct sk_buff *skb); | 115 | int __ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb); |
116 | int ip_local_out_sk(struct sock *sk, struct sk_buff *skb); | 116 | int ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb); |
117 | static inline int ip_local_out(struct sk_buff *skb) | ||
118 | { | ||
119 | return ip_local_out_sk(skb->sk, skb); | ||
120 | } | ||
121 | 117 | ||
122 | int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl); | 118 | int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl); |
123 | void ip_init(void); | 119 | void ip_init(void); |
@@ -282,10 +278,12 @@ int ip_decrease_ttl(struct iphdr *iph) | |||
282 | } | 278 | } |
283 | 279 | ||
284 | static inline | 280 | static inline |
285 | int ip_dont_fragment(struct sock *sk, struct dst_entry *dst) | 281 | int ip_dont_fragment(const struct sock *sk, const struct dst_entry *dst) |
286 | { | 282 | { |
287 | return inet_sk(sk)->pmtudisc == IP_PMTUDISC_DO || | 283 | u8 pmtudisc = READ_ONCE(inet_sk(sk)->pmtudisc); |
288 | (inet_sk(sk)->pmtudisc == IP_PMTUDISC_WANT && | 284 | |
285 | return pmtudisc == IP_PMTUDISC_DO || | ||
286 | (pmtudisc == IP_PMTUDISC_WANT && | ||
289 | !(dst_metric_locked(dst, RTAX_MTU))); | 287 | !(dst_metric_locked(dst, RTAX_MTU))); |
290 | } | 288 | } |
291 | 289 | ||
@@ -321,12 +319,15 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst, | |||
321 | 319 | ||
322 | static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb) | 320 | static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb) |
323 | { | 321 | { |
324 | if (!skb->sk || ip_sk_use_pmtu(skb->sk)) { | 322 | struct sock *sk = skb->sk; |
323 | |||
324 | if (!sk || !sk_fullsock(sk) || ip_sk_use_pmtu(sk)) { | ||
325 | bool forwarding = IPCB(skb)->flags & IPSKB_FORWARDED; | 325 | bool forwarding = IPCB(skb)->flags & IPSKB_FORWARDED; |
326 | |||
326 | return ip_dst_mtu_maybe_forward(skb_dst(skb), forwarding); | 327 | return ip_dst_mtu_maybe_forward(skb_dst(skb), forwarding); |
327 | } else { | ||
328 | return min(skb_dst(skb)->dev->mtu, IP_MAX_MTU); | ||
329 | } | 328 | } |
329 | |||
330 | return min(skb_dst(skb)->dev->mtu, IP_MAX_MTU); | ||
330 | } | 331 | } |
331 | 332 | ||
332 | u32 ip_idents_reserve(u32 hash, int segs); | 333 | u32 ip_idents_reserve(u32 hash, int segs); |
@@ -505,11 +506,11 @@ static inline bool ip_defrag_user_in_between(u32 user, | |||
505 | return user >= lower_bond && user <= upper_bond; | 506 | return user >= lower_bond && user <= upper_bond; |
506 | } | 507 | } |
507 | 508 | ||
508 | int ip_defrag(struct sk_buff *skb, u32 user); | 509 | int ip_defrag(struct net *net, struct sk_buff *skb, u32 user); |
509 | #ifdef CONFIG_INET | 510 | #ifdef CONFIG_INET |
510 | struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user); | 511 | struct sk_buff *ip_check_defrag(struct net *net, struct sk_buff *skb, u32 user); |
511 | #else | 512 | #else |
512 | static inline struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user) | 513 | static inline struct sk_buff *ip_check_defrag(struct net *net, struct sk_buff *skb, u32 user) |
513 | { | 514 | { |
514 | return skb; | 515 | return skb; |
515 | } | 516 | } |