Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv6: eliminate ndisc_ops_is_useropt()

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>

authored by

Maciej Żenczykowski and committed by
Jakub Kicinski
246ef406 9a4615be

+2 -23
-15
include/net/ndisc.h
··· 147 147 * The following hooks can be defined; unless noted otherwise, they are 148 148 * optional and can be filled with a null pointer. 149 149 * 150 - * int (*is_useropt)(u8 nd_opt_type): 151 - * This function is called when IPv6 decide RA userspace options. if 152 - * this function returns 1 then the option given by nd_opt_type will 153 - * be handled as userspace option additional to the IPv6 options. 154 - * 155 150 * int (*parse_options)(const struct net_device *dev, 156 151 * struct nd_opt_hdr *nd_opt, 157 152 * struct ndisc_options *ndopts): ··· 195 200 * addresses. E.g. 802.15.4 6LoWPAN. 196 201 */ 197 202 struct ndisc_ops { 198 - int (*is_useropt)(u8 nd_opt_type); 199 203 int (*parse_options)(const struct net_device *dev, 200 204 struct nd_opt_hdr *nd_opt, 201 205 struct ndisc_options *ndopts); ··· 218 224 }; 219 225 220 226 #if IS_ENABLED(CONFIG_IPV6) 221 - static inline int ndisc_ops_is_useropt(const struct net_device *dev, 222 - u8 nd_opt_type) 223 - { 224 - if (dev->ndisc_ops && dev->ndisc_ops->is_useropt) 225 - return dev->ndisc_ops->is_useropt(nd_opt_type); 226 - else 227 - return 0; 228 - } 229 - 230 227 static inline int ndisc_ops_parse_options(const struct net_device *dev, 231 228 struct nd_opt_hdr *nd_opt, 232 229 struct ndisc_options *ndopts)
-6
net/6lowpan/ndisc.c
··· 11 11 12 12 #include "6lowpan_i.h" 13 13 14 - static int lowpan_ndisc_is_useropt(u8 nd_opt_type) 15 - { 16 - return nd_opt_type == ND_OPT_6CO; 17 - } 18 - 19 14 #if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN) 20 15 #define NDISC_802154_SHORT_ADDR_LENGTH 1 21 16 static int lowpan_ndisc_parse_802154_options(const struct net_device *dev, ··· 217 222 #endif 218 223 219 224 const struct ndisc_ops lowpan_ndisc_ops = { 220 - .is_useropt = lowpan_ndisc_is_useropt, 221 225 #if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN) 222 226 .parse_options = lowpan_ndisc_parse_options, 223 227 .update = lowpan_ndisc_update,
+2 -2
net/ipv6/ndisc.c
··· 200 200 return opt->nd_opt_type == ND_OPT_PREFIX_INFO || 201 201 opt->nd_opt_type == ND_OPT_RDNSS || 202 202 opt->nd_opt_type == ND_OPT_DNSSL || 203 + opt->nd_opt_type == ND_OPT_6CO || 203 204 opt->nd_opt_type == ND_OPT_CAPTIVE_PORTAL || 204 - opt->nd_opt_type == ND_OPT_PREF64 || 205 - ndisc_ops_is_useropt(dev, opt->nd_opt_type); 205 + opt->nd_opt_type == ND_OPT_PREF64; 206 206 } 207 207 208 208 static struct nd_opt_hdr *ndisc_next_useropt(const struct net_device *dev,