kernel : Bump to 4.14.325
[librecmc/librecmc.git] / target / linux / generic / backport-4.14 / 350-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Fri, 16 Feb 2018 10:54:24 +0100
3 Subject: [PATCH] ipv6: make ip6_dst_mtu_forward inline
4
5 Removes a direct dependency on ipv6.ko
6
7 Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 ---
9
10 --- a/include/net/ip6_route.h
11 +++ b/include/net/ip6_route.h
12 @@ -253,4 +253,26 @@ static inline bool rt6_duplicate_nexthop
13                ipv6_addr_equal(&a->rt6i_gateway, &b->rt6i_gateway) &&
14                !lwtunnel_cmp_encap(a->dst.lwtstate, b->dst.lwtstate);
15  }
16 +
17 +static inline unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst)
18 +{
19 +       unsigned int mtu;
20 +       struct inet6_dev *idev;
21 +
22 +       if (dst_metric_locked(dst, RTAX_MTU)) {
23 +               mtu = dst_metric_raw(dst, RTAX_MTU);
24 +               if (mtu)
25 +                       return mtu;
26 +       }
27 +
28 +       mtu = IPV6_MIN_MTU;
29 +       rcu_read_lock();
30 +       idev = __in6_dev_get(dst->dev);
31 +       if (idev)
32 +               mtu = idev->cnf.mtu6;
33 +       rcu_read_unlock();
34 +
35 +       return mtu;
36 +}
37 +
38  #endif
39 --- a/include/net/ipv6.h
40 +++ b/include/net/ipv6.h
41 @@ -856,8 +856,6 @@ static inline struct sk_buff *ip6_finish
42                               &inet6_sk(sk)->cork);
43  }
44  
45 -unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst);
46 -
47  int ip6_dst_lookup(struct net *net, struct sock *sk, struct dst_entry **dst,
48                    struct flowi6 *fl6);
49  struct dst_entry *ip6_dst_lookup_flow(struct net *net, const struct sock *sk, struct flowi6 *fl6,
50 --- a/net/ipv6/ip6_output.c
51 +++ b/net/ipv6/ip6_output.c
52 @@ -419,28 +419,6 @@ static inline int ip6_forward_finish(str
53         return dst_output(net, sk, skb);
54  }
55  
56 -unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst)
57 -{
58 -       unsigned int mtu;
59 -       struct inet6_dev *idev;
60 -
61 -       if (dst_metric_locked(dst, RTAX_MTU)) {
62 -               mtu = dst_metric_raw(dst, RTAX_MTU);
63 -               if (mtu)
64 -                       return mtu;
65 -       }
66 -
67 -       mtu = IPV6_MIN_MTU;
68 -       rcu_read_lock();
69 -       idev = __in6_dev_get(dst->dev);
70 -       if (idev)
71 -               mtu = idev->cnf.mtu6;
72 -       rcu_read_unlock();
73 -
74 -       return mtu;
75 -}
76 -EXPORT_SYMBOL_GPL(ip6_dst_mtu_forward);
77 -
78  static bool ip6_pkt_too_big(const struct sk_buff *skb, unsigned int mtu)
79  {
80         if (skb->len <= mtu)