aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ip.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/ip.h')
-rw-r--r--include/net/ip.h41
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
103int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, 103int 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);
106int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, 106int 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);
108int ip_local_deliver(struct sk_buff *skb); 108int ip_local_deliver(struct sk_buff *skb);
109int ip_mr_input(struct sk_buff *skb); 109int ip_mr_input(struct sk_buff *skb);
110int ip_output(struct sock *sk, struct sk_buff *skb); 110int ip_output(struct net *net, struct sock *sk, struct sk_buff *skb);
111int ip_mc_output(struct sock *sk, struct sk_buff *skb); 111int ip_mc_output(struct net *net, struct sock *sk, struct sk_buff *skb);
112int ip_do_fragment(struct sock *sk, struct sk_buff *skb, 112int 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 *));
114void ip_send_check(struct iphdr *ip); 114void ip_send_check(struct iphdr *ip);
115int __ip_local_out(struct sk_buff *skb); 115int __ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
116int ip_local_out_sk(struct sock *sk, struct sk_buff *skb); 116int ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
117static inline int ip_local_out(struct sk_buff *skb)
118{
119 return ip_local_out_sk(skb->sk, skb);
120}
121 117
122int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl); 118int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl);
123void ip_init(void); 119void ip_init(void);
@@ -282,10 +278,12 @@ int ip_decrease_ttl(struct iphdr *iph)
282} 278}
283 279
284static inline 280static inline
285int ip_dont_fragment(struct sock *sk, struct dst_entry *dst) 281int 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
322static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb) 320static 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
332u32 ip_idents_reserve(u32 hash, int segs); 333u32 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
508int ip_defrag(struct sk_buff *skb, u32 user); 509int ip_defrag(struct net *net, struct sk_buff *skb, u32 user);
509#ifdef CONFIG_INET 510#ifdef CONFIG_INET
510struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user); 511struct sk_buff *ip_check_defrag(struct net *net, struct sk_buff *skb, u32 user);
511#else 512#else
512static inline struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user) 513static 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}