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
147 * The following hooks can be defined; unless noted otherwise, they are147 * The following hooks can be defined; unless noted otherwise, they are
148 * optional and can be filled with a null pointer.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 * int (*parse_options)(const struct net_device *dev,150 * int (*parse_options)(const struct net_device *dev,
156 * struct nd_opt_hdr *nd_opt,151 * struct nd_opt_hdr *nd_opt,
157 * struct ndisc_options *ndopts):152 * 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
200 * addresses. E.g. 802.15.4 6LoWPAN.195 * addresses. E.g. 802.15.4 6LoWPAN.
201 */196 */
202struct ndisc_ops {197struct ndisc_ops {
203 int (*is_useropt)(u8 nd_opt_type);
204 int (*parse_options)(const struct net_device *dev,198 int (*parse_options)(const struct net_device *dev,
205 struct nd_opt_hdr *nd_opt,199 struct nd_opt_hdr *nd_opt,
206 struct ndisc_options *ndopts);200 struct ndisc_options *ndopts);
@@ -224,15 +218,6 @@ struct ndisc_ops { · 17 unmodified lines
224};218};
225 219
226#if IS_ENABLED(CONFIG_IPV6)220#if IS_ENABLED(CONFIG_IPV6)
227static 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
236static inline int ndisc_ops_parse_options(const struct net_device *dev,221static inline int ndisc_ops_parse_options(const struct net_device *dev,
237 struct nd_opt_hdr *nd_opt,222 struct nd_opt_hdr *nd_opt,
238 struct ndisc_options *ndopts)223 struct ndisc_options *ndopts)
net/6lowpan/ndisc.c+0−6
@@ -11,11 +11,6 @@ · 10 unmodified lines
11 11
12#include "6lowpan_i.h"12#include "6lowpan_i.h"
13 13
14static int lowpan_ndisc_is_useropt(u8 nd_opt_type)
15{
16 return nd_opt_type == ND_OPT_6CO;
17}
18
19#if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)14#if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
20#define NDISC_802154_SHORT_ADDR_LENGTH 115#define NDISC_802154_SHORT_ADDR_LENGTH 1
21static int lowpan_ndisc_parse_802154_options(const struct net_device *dev,16static 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
222#endif217#endif
223 218
224const struct ndisc_ops lowpan_ndisc_ops = {219const struct ndisc_ops lowpan_ndisc_ops = {
225 .is_useropt = lowpan_ndisc_is_useropt,
226#if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)220#if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
227 .parse_options = lowpan_ndisc_parse_options,221 .parse_options = lowpan_ndisc_parse_options,
228 .update = lowpan_ndisc_update,222 .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
200 return opt->nd_opt_type == ND_OPT_PREFIX_INFO ||200 return opt->nd_opt_type == ND_OPT_PREFIX_INFO ||
201 opt->nd_opt_type == ND_OPT_RDNSS ||201 opt->nd_opt_type == ND_OPT_RDNSS ||
202 opt->nd_opt_type == ND_OPT_DNSSL ||202 opt->nd_opt_type == ND_OPT_DNSSL ||
203 opt->nd_opt_type == ND_OPT_6CO ||
203 opt->nd_opt_type == ND_OPT_CAPTIVE_PORTAL ||204 opt->nd_opt_type == ND_OPT_CAPTIVE_PORTAL ||
204 opt->nd_opt_type == ND_OPT_PREF64 ||205 opt->nd_opt_type == ND_OPT_PREF64;
205 ndisc_ops_is_useropt(dev, opt->nd_opt_type);
206}206}
207 207
208static struct nd_opt_hdr *ndisc_next_useropt(const struct net_device *dev,208static struct nd_opt_hdr *ndisc_next_useropt(const struct net_device *dev,