net: remove unnecessary input parameter 'how' in ifdown function
authorZhengchao Shao <shaozhengchao@huawei.com>
Mon, 21 Aug 2023 08:41:04 +0000 (16:41 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 22 Aug 2023 11:19:02 +0000 (13:19 +0200)
When the ifdown function in the dst_ops structure is referenced, the input
parameter 'how' is always true. In the current implementation of the
ifdown interface, ip6_dst_ifdown does not use the input parameter 'how',
xfrm6_dst_ifdown and xfrm4_dst_ifdown functions use the input parameter
'unregister'. But false judgment on 'unregister' in xfrm6_dst_ifdown and
xfrm4_dst_ifdown is false, so remove the input parameter 'how' in ifdown
function.

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230821084104.3812233-1-shaozhengchao@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
include/net/dst_ops.h
net/core/dst.c
net/ipv4/xfrm4_policy.c
net/ipv6/route.c
net/ipv6/xfrm6_policy.c

index 632086b..6d1c854 100644 (file)
@@ -23,7 +23,7 @@ struct dst_ops {
        u32 *                   (*cow_metrics)(struct dst_entry *, unsigned long);
        void                    (*destroy)(struct dst_entry *);
        void                    (*ifdown)(struct dst_entry *,
-                                         struct net_device *dev, int how);
+                                         struct net_device *dev);
        struct dst_entry *      (*negative_advice)(struct dst_entry *);
        void                    (*link_failure)(struct sk_buff *);
        void                    (*update_pmtu)(struct dst_entry *dst, struct sock *sk,
index 79d9306..980e2fd 100644 (file)
@@ -152,7 +152,7 @@ void dst_dev_put(struct dst_entry *dst)
 
        dst->obsolete = DST_OBSOLETE_DEAD;
        if (dst->ops->ifdown)
-               dst->ops->ifdown(dst, dev, true);
+               dst->ops->ifdown(dst, dev);
        dst->input = dst_discard;
        dst->output = dst_discard_out;
        dst->dev = blackhole_netdev;
index 9403bba..cdcc0f6 100644 (file)
@@ -124,22 +124,13 @@ static void xfrm4_dst_destroy(struct dst_entry *dst)
        xfrm_dst_destroy(xdst);
 }
 
-static void xfrm4_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
-                            int unregister)
-{
-       if (!unregister)
-               return;
-
-       xfrm_dst_ifdown(dst, dev);
-}
-
 static struct dst_ops xfrm4_dst_ops_template = {
        .family =               AF_INET,
        .update_pmtu =          xfrm4_update_pmtu,
        .redirect =             xfrm4_redirect,
        .cow_metrics =          dst_cow_metrics_generic,
        .destroy =              xfrm4_dst_destroy,
-       .ifdown =               xfrm4_dst_ifdown,
+       .ifdown =               xfrm_dst_ifdown,
        .local_out =            __ip_local_out,
        .gc_thresh =            32768,
 };
index a5b74b9..846aec8 100644 (file)
@@ -90,7 +90,7 @@ unsigned int          ip6_mtu(const struct dst_entry *dst);
 static struct dst_entry *ip6_negative_advice(struct dst_entry *);
 static void            ip6_dst_destroy(struct dst_entry *);
 static void            ip6_dst_ifdown(struct dst_entry *,
-                                      struct net_device *dev, int how);
+                                      struct net_device *dev);
 static void             ip6_dst_gc(struct dst_ops *ops);
 
 static int             ip6_pkt_discard(struct sk_buff *skb);
@@ -371,8 +371,7 @@ static void ip6_dst_destroy(struct dst_entry *dst)
        fib6_info_release(from);
 }
 
-static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
-                          int how)
+static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev)
 {
        struct rt6_info *rt = (struct rt6_info *)dst;
        struct inet6_dev *idev = rt->rt6i_idev;
index eecc5e5..188224a 100644 (file)
@@ -124,14 +124,10 @@ static void xfrm6_dst_destroy(struct dst_entry *dst)
        xfrm_dst_destroy(xdst);
 }
 
-static void xfrm6_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
-                            int unregister)
+static void xfrm6_dst_ifdown(struct dst_entry *dst, struct net_device *dev)
 {
        struct xfrm_dst *xdst;
 
-       if (!unregister)
-               return;
-
        xdst = (struct xfrm_dst *)dst;
        if (xdst->u.rt6.rt6i_idev->dev == dev) {
                struct inet6_dev *loopback_idev =