Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Authors:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * (C) 2016 Pengutronix, Alexander Aring <aar@pengutronix.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <net/6lowpan.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <net/addrconf.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <net/ndisc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include "6lowpan_i.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) static int lowpan_ndisc_is_useropt(u8 nd_opt_type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	return nd_opt_type == ND_OPT_6CO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define NDISC_802154_SHORT_ADDR_LENGTH	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) static int lowpan_ndisc_parse_802154_options(const struct net_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 					     struct nd_opt_hdr *nd_opt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 					     struct ndisc_options *ndopts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	switch (nd_opt->nd_opt_len) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	case NDISC_802154_SHORT_ADDR_LENGTH:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 		if (ndopts->nd_802154_opt_array[nd_opt->nd_opt_type])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 			ND_PRINTK(2, warn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 				  "%s: duplicated short addr ND6 option found: type=%d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 				  __func__, nd_opt->nd_opt_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 		else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 			ndopts->nd_802154_opt_array[nd_opt->nd_opt_type] = nd_opt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 		return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 		/* all others will be handled by ndisc IPv6 option parsing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) static int lowpan_ndisc_parse_options(const struct net_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 				      struct nd_opt_hdr *nd_opt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 				      struct ndisc_options *ndopts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	if (!lowpan_is_ll(dev, LOWPAN_LLTYPE_IEEE802154))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	switch (nd_opt->nd_opt_type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	case ND_OPT_SOURCE_LL_ADDR:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	case ND_OPT_TARGET_LL_ADDR:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 		return lowpan_ndisc_parse_802154_options(dev, nd_opt, ndopts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) static void lowpan_ndisc_802154_update(struct neighbour *n, u32 flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 				       u8 icmp6_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 				       const struct ndisc_options *ndopts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	struct lowpan_802154_neigh *neigh = lowpan_802154_neigh(neighbour_priv(n));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	u8 *lladdr_short = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	switch (icmp6_type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	case NDISC_ROUTER_SOLICITATION:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	case NDISC_ROUTER_ADVERTISEMENT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	case NDISC_NEIGHBOUR_SOLICITATION:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		if (ndopts->nd_802154_opts_src_lladdr) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 			lladdr_short = __ndisc_opt_addr_data(ndopts->nd_802154_opts_src_lladdr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 							     IEEE802154_SHORT_ADDR_LEN, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 			if (!lladdr_short) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 				ND_PRINTK(2, warn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 					  "NA: invalid short link-layer address length\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 				return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	case NDISC_REDIRECT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	case NDISC_NEIGHBOUR_ADVERTISEMENT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 		if (ndopts->nd_802154_opts_tgt_lladdr) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 			lladdr_short = __ndisc_opt_addr_data(ndopts->nd_802154_opts_tgt_lladdr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 							     IEEE802154_SHORT_ADDR_LEN, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 			if (!lladdr_short) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 				ND_PRINTK(2, warn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 					  "NA: invalid short link-layer address length\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 				return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	write_lock_bh(&n->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	if (lladdr_short) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		ieee802154_be16_to_le16(&neigh->short_addr, lladdr_short);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		if (!lowpan_802154_is_valid_src_short_addr(neigh->short_addr))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 			neigh->short_addr = cpu_to_le16(IEEE802154_ADDR_SHORT_UNSPEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	write_unlock_bh(&n->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) static void lowpan_ndisc_update(const struct net_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 				struct neighbour *n, u32 flags, u8 icmp6_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 				const struct ndisc_options *ndopts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	if (!lowpan_is_ll(dev, LOWPAN_LLTYPE_IEEE802154))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	/* react on overrides only. TODO check if this is really right. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	if (flags & NEIGH_UPDATE_F_OVERRIDE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 		lowpan_ndisc_802154_update(n, flags, icmp6_type, ndopts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) static int lowpan_ndisc_opt_addr_space(const struct net_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 				       u8 icmp6_type, struct neighbour *neigh,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 				       u8 *ha_buf, u8 **ha)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	struct lowpan_802154_neigh *n;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	struct wpan_dev *wpan_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	int addr_space = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	if (!lowpan_is_ll(dev, LOWPAN_LLTYPE_IEEE802154))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	switch (icmp6_type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	case NDISC_REDIRECT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		n = lowpan_802154_neigh(neighbour_priv(neigh));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		read_lock_bh(&neigh->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		if (lowpan_802154_is_valid_src_short_addr(n->short_addr)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 			memcpy(ha_buf, &n->short_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 			       IEEE802154_SHORT_ADDR_LEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 			read_unlock_bh(&neigh->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 			addr_space += __ndisc_opt_addr_space(IEEE802154_SHORT_ADDR_LEN, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 			*ha = ha_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 			read_unlock_bh(&neigh->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	case NDISC_NEIGHBOUR_ADVERTISEMENT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	case NDISC_NEIGHBOUR_SOLICITATION:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	case NDISC_ROUTER_SOLICITATION:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		wpan_dev = lowpan_802154_dev(dev)->wdev->ieee802154_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 		if (lowpan_802154_is_valid_src_short_addr(wpan_dev->short_addr))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 			addr_space = __ndisc_opt_addr_space(IEEE802154_SHORT_ADDR_LEN, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	return addr_space;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) static void lowpan_ndisc_fill_addr_option(const struct net_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 					  struct sk_buff *skb, u8 icmp6_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 					  const u8 *ha)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	struct wpan_dev *wpan_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	__be16 short_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	u8 opt_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	if (!lowpan_is_ll(dev, LOWPAN_LLTYPE_IEEE802154))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	switch (icmp6_type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	case NDISC_REDIRECT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 		if (ha) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 			ieee802154_le16_to_be16(&short_addr, ha);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 			__ndisc_fill_addr_option(skb, ND_OPT_TARGET_LL_ADDR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 						 &short_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 						 IEEE802154_SHORT_ADDR_LEN, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	case NDISC_NEIGHBOUR_ADVERTISEMENT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		opt_type = ND_OPT_TARGET_LL_ADDR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	case NDISC_ROUTER_SOLICITATION:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	case NDISC_NEIGHBOUR_SOLICITATION:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 		opt_type = ND_OPT_SOURCE_LL_ADDR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	wpan_dev = lowpan_802154_dev(dev)->wdev->ieee802154_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	if (lowpan_802154_is_valid_src_short_addr(wpan_dev->short_addr)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		ieee802154_le16_to_be16(&short_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 					&wpan_dev->short_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 		__ndisc_fill_addr_option(skb, opt_type, &short_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 					 IEEE802154_SHORT_ADDR_LEN, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) static void lowpan_ndisc_prefix_rcv_add_addr(struct net *net,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 					     struct net_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 					     const struct prefix_info *pinfo,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 					     struct inet6_dev *in6_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 					     struct in6_addr *addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 					     int addr_type, u32 addr_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 					     bool sllao, bool tokenized,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 					     __u32 valid_lft,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 					     u32 prefered_lft,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 					     bool dev_addr_generated)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	/* generates short based address for RA PIO's */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	if (lowpan_is_ll(dev, LOWPAN_LLTYPE_IEEE802154) && dev_addr_generated &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	    !addrconf_ifid_802154_6lowpan(addr->s6_addr + 8, dev)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		err = addrconf_prefix_rcv_add_addr(net, dev, pinfo, in6_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 						   addr, addr_type, addr_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 						   sllao, tokenized, valid_lft,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 						   prefered_lft);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 		if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 			ND_PRINTK(2, warn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 				  "RA: could not add a short address based address for prefix: %pI6c\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 				  &pinfo->prefix);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) const struct ndisc_ops lowpan_ndisc_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	.is_useropt		= lowpan_ndisc_is_useropt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) #if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	.parse_options		= lowpan_ndisc_parse_options,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	.update			= lowpan_ndisc_update,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	.opt_addr_space		= lowpan_ndisc_opt_addr_space,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	.fill_addr_option	= lowpan_ndisc_fill_addr_option,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	.prefix_rcv_add_addr	= lowpan_ndisc_prefix_rcv_add_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) };