History

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...

Maciej Żenczykowski committed 2 years ago

Commit 246ef401 parent 9a4615b3 files · +2 −23Browse files

Unified · Split

3 files
  1. include/net/ndisc.h +0 −15
  2. net/6lowpan/ndisc.c +0 −6
  3. net/ipv6/ndisc.c +2 −2
include/net/ndisc.h+0−15
@@ -147,11 +147,6 @@ void __ndisc_fill_addr_option(struct sk_buff *skb, int type, const void *data, · 146 unmodified lines
147147 * The following hooks can be defined; unless noted otherwise, they are
148148 * optional and can be filled with a null pointer.
149149 *
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− *
155150 * int (*parse_options)(const struct net_device *dev,
156151 * struct nd_opt_hdr *nd_opt,
157152 * struct ndisc_options *ndopts):
@@ -200,7 +195,6 @@ void __ndisc_fill_addr_option(struct sk_buff *skb, int type, const void *data, · 42 unmodified lines
200195 * addresses. E.g. 802.15.4 6LoWPAN.
201196 */
202197 struct ndisc_ops {
203− int (*is_useropt)(u8 nd_opt_type);
204198 int (*parse_options)(const struct net_device *dev,
205199 struct nd_opt_hdr *nd_opt,
206200 struct ndisc_options *ndopts);
@@ -224,15 +218,6 @@ struct ndisc_ops { · 17 unmodified lines
224218 };
225219
226220 #if IS_ENABLED(CONFIG_IPV6)
227−static inline int ndisc_ops_is_useropt(const struct net_device *dev,
228− u8 nd_opt_type)
229−{
230− if (dev->ndisc_ops && dev->ndisc_ops->is_useropt)
231− return dev->ndisc_ops->is_useropt(nd_opt_type);
232− else
233− return 0;
234−}
235−
236221 static inline int ndisc_ops_parse_options(const struct net_device *dev,
237222 struct nd_opt_hdr *nd_opt,
238223 struct ndisc_options *ndopts)
net/6lowpan/ndisc.c+0−6
@@ -11,11 +11,6 @@ · 10 unmodified lines
1111
1212 #include "6lowpan_i.h"
1313
14−static int lowpan_ndisc_is_useropt(u8 nd_opt_type)
15−{
16− return nd_opt_type == ND_OPT_6CO;
17−}
18−
1914 #if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
2015 #define NDISC_802154_SHORT_ADDR_LENGTH 1
2116 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, · 200 unmodified lines
222217 #endif
223218
224219 const struct ndisc_ops lowpan_ndisc_ops = {
225− .is_useropt = lowpan_ndisc_is_useropt,
226220 #if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
227221 .parse_options = lowpan_ndisc_parse_options,
228222 .update = lowpan_ndisc_update,
net/ipv6/ndisc.c+2−2
@@ -200,9 +200,9 @@ static inline int ndisc_is_useropt(const struct net_device *dev, · 199 unmodified lines
200200 return opt->nd_opt_type == ND_OPT_PREFIX_INFO ||
201201 opt->nd_opt_type == ND_OPT_RDNSS ||
202202 opt->nd_opt_type == ND_OPT_DNSSL ||
203+ opt->nd_opt_type == ND_OPT_6CO ||
203204 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;
206206 }
207207
208208 static struct nd_opt_hdr *ndisc_next_useropt(const struct net_device *dev,