ipv6: eliminate ndisc_ops_is_useropt()
authorMaciej Żenczykowski <maze@google.com>
Tue, 30 Jul 2024 00:30:10 +0000 (17:30 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 13 Aug 2024 00:23:57 +0000 (17:23 -0700)
as it doesn't seem to offer anything of value.

There's only 1 trivial user:
  int lowpan_ndisc_is_useropt(u8 nd_opt_type) {
    return nd_opt_type == ND_OPT_6CO;
  }

but there's no harm to always treating that as
a useropt...

Cc: David Ahern <dsahern@kernel.org>
Cc: YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Link: https://patch.msgid.link/20240730003010.156977-1-maze@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/ndisc.h
net/6lowpan/ndisc.c
net/ipv6/ndisc.c

index 7a533d5b1d59fb70c1c4486b31085359bedf4115..3c88d5bc5eed5e78498f53b93b945639ff8c5255 100644 (file)
@@ -147,11 +147,6 @@ void __ndisc_fill_addr_option(struct sk_buff *skb, int type, const void *data,
  * The following hooks can be defined; unless noted otherwise, they are
  * optional and can be filled with a null pointer.
  *
- * int (*is_useropt)(u8 nd_opt_type):
- *     This function is called when IPv6 decide RA userspace options. if
- *     this function returns 1 then the option given by nd_opt_type will
- *     be handled as userspace option additional to the IPv6 options.
- *
  * int (*parse_options)(const struct net_device *dev,
  *                     struct nd_opt_hdr *nd_opt,
  *                     struct ndisc_options *ndopts):
@@ -200,7 +195,6 @@ void __ndisc_fill_addr_option(struct sk_buff *skb, int type, const void *data,
  *     addresses. E.g. 802.15.4 6LoWPAN.
  */
 struct ndisc_ops {
-       int     (*is_useropt)(u8 nd_opt_type);
        int     (*parse_options)(const struct net_device *dev,
                                 struct nd_opt_hdr *nd_opt,
                                 struct ndisc_options *ndopts);
@@ -224,15 +218,6 @@ struct ndisc_ops {
 };
 
 #if IS_ENABLED(CONFIG_IPV6)
-static inline int ndisc_ops_is_useropt(const struct net_device *dev,
-                                      u8 nd_opt_type)
-{
-       if (dev->ndisc_ops && dev->ndisc_ops->is_useropt)
-               return dev->ndisc_ops->is_useropt(nd_opt_type);
-       else
-               return 0;
-}
-
 static inline int ndisc_ops_parse_options(const struct net_device *dev,
                                          struct nd_opt_hdr *nd_opt,
                                          struct ndisc_options *ndopts)
index 16be8f8b2f8ca8295956778cca9fe071e0048d8b..c40b98f7743cd426a4e15df99830fc8104195d0a 100644 (file)
 
 #include "6lowpan_i.h"
 
-static int lowpan_ndisc_is_useropt(u8 nd_opt_type)
-{
-       return nd_opt_type == ND_OPT_6CO;
-}
-
 #if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
 #define NDISC_802154_SHORT_ADDR_LENGTH 1
 static int lowpan_ndisc_parse_802154_options(const struct net_device *dev,
@@ -222,7 +217,6 @@ static void lowpan_ndisc_prefix_rcv_add_addr(struct net *net,
 #endif
 
 const struct ndisc_ops lowpan_ndisc_ops = {
-       .is_useropt             = lowpan_ndisc_is_useropt,
 #if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
        .parse_options          = lowpan_ndisc_parse_options,
        .update                 = lowpan_ndisc_update,
index b8eec1b6cc2c88bfbf66fec165a6a8782ffd8242..1e42e40fb379c24223d4f34c85182bb9af670c82 100644 (file)
@@ -200,9 +200,9 @@ static inline int ndisc_is_useropt(const struct net_device *dev,
        return opt->nd_opt_type == ND_OPT_PREFIX_INFO ||
                opt->nd_opt_type == ND_OPT_RDNSS ||
                opt->nd_opt_type == ND_OPT_DNSSL ||
+               opt->nd_opt_type == ND_OPT_6CO ||
                opt->nd_opt_type == ND_OPT_CAPTIVE_PORTAL ||
-               opt->nd_opt_type == ND_OPT_PREF64 ||
-               ndisc_ops_is_useropt(dev, opt->nd_opt_type);
+               opt->nd_opt_type == ND_OPT_PREF64;
 }
 
 static struct nd_opt_hdr *ndisc_next_useropt(const struct net_device *dev,