All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
To: Alexander Aring <aar@pengutronix.de>, linux-wpan@vger.kernel.org
Cc: kernel@pengutronix.de, jukka.rissanen@linux.intel.com,
	stefan@osg.samsung.com, mcr@sandelman.ca, werner@almesberger.net
Subject: Re: [RFC bluetooth-next 13/19] addrconf: add 802.15.4 short addr slaac
Date: Wed, 23 Mar 2016 11:50:12 +0100	[thread overview]
Message-ID: <56F274E4.2050205@stressinduktion.org> (raw)
In-Reply-To: <1458652515-7862-14-git-send-email-aar@pengutronix.de>

On 22.03.2016 14:15, Alexander Aring wrote:
> This patch adds the autoconfiguration if a valid 802.15.4 short address
> is available for 802.15.4 6LoWPAN interfaces.
>
> Signed-off-by: Alexander Aring <aar@pengutronix.de>
> ---
>   net/ipv6/addrconf.c | 40 ++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 40 insertions(+)
>
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 27aed1a..eb3e3fb 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -3058,6 +3058,37 @@ static void ipv6_gen_mode_random_init(struct inet6_dev *idev)
>   	s->initialized = true;
>   }
>
> +#ifdef CONFIG_IEEE802154_6LOWPAN
> +static int addrconf_ifid_ieee802154(u8 *eui, struct net_device *dev)
> +{
> +	struct wpan_dev *wpan_dev = lowpan_802154_dev(dev)->wdev->ieee802154_ptr;
> +
> +	/* Set short_addr autoconfiguration if short_addr is present only */
> +	if (!ieee802154_is_valid_src_short_addr(wpan_dev->short_addr))
> +		return -1;
> +
> +	/* For either address format, all zero addresses MUST NOT be used */
> +	if (wpan_dev->pan_id == cpu_to_le16(0x0000) &&
> +	    wpan_dev->short_addr == cpu_to_le16(0x0000))
> +		return -1;
> +
> +	/* Alternatively, if no PAN ID is known, 16 zero bits may be used */
> +	if (wpan_dev->pan_id == cpu_to_le16(IEEE802154_PAN_ID_BROADCAST))
> +		memset(eui, 0, 2);
> +	else
> +		ieee802154_le16_to_be16(eui, &wpan_dev->pan_id);
> +
> +	/* The "Universal/Local" (U/L) bit shall be set to zero */
> +	eui[0] &= ~2;
> +	eui[2] = 0;
> +	eui[3] = 0xFF;
> +	eui[4] = 0xFE;
> +	eui[5] = 0;
> +	ieee802154_le16_to_be16(&eui[6], &wpan_dev->short_addr);
> +	return 0;
> +}

static void configure lowpan_addrconf(idev, addr)
{
 > +			if (addrconf_ifid_ieee802154(addr.s6_addr + 8,
 > +						     idev->dev) == 0)
 > +				addrconf_add_linklocal(idev, &addr, 0);
}

#else

static void configure lowpan_addrconf(idev, addr)
{
}

> +#endif

So we don't need the ifdef in addrconf_addr_gen. I think it pretty much 
reflects what upstream wants.

> +
>   static void addrconf_addr_gen(struct inet6_dev *idev, bool prefix_route)
>   {
>   	struct in6_addr addr;
> @@ -3088,6 +3119,15 @@ static void addrconf_addr_gen(struct inet6_dev *idev, bool prefix_route)
>   			addrconf_add_linklocal(idev, &addr, 0);
>   		else if (prefix_route)
>   			addrconf_prefix_route(&addr, 64, idev->dev, 0, 0);
> +
> +		/* 802.15.4 6LoWPAN short address slaac handling */
> +		if (lowpan_is_ll(idev->dev, LOWPAN_LLTYPE_IEEE802154)) {
> +		}

Do you think it makes sense to put this under the label 
IN_ADDR_GEN_MODE_EUI64? I don't see a real issue with it, maybe it 
conflicts a little bit with the naming.

Otherwise I don't have any issue with the change.

Bye,
Hannes


  reply	other threads:[~2016-03-23 10:50 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-22 13:14 [RFC bluetooth-next 00/19] 6lowpan: l2 neighbour data and short address Alexander Aring
2016-03-22 13:14 ` [RFC bluetooth-next 01/19] ieee802154: cleanups for ieee802154.h Alexander Aring
2016-03-23  9:59   ` Stefan Schmidt
2016-03-22 13:14 ` [RFC bluetooth-next 02/19] ieee802154: add short address helpers Alexander Aring
2016-03-23  9:59   ` Stefan Schmidt
2016-03-22 13:14 ` [RFC bluetooth-next 03/19] nl802154: avoid address change while running lowpan Alexander Aring
2016-03-23  9:59   ` Stefan Schmidt
2016-03-22 13:15 ` [RFC bluetooth-next 04/19] ieee802154: 6lowpan: fix short addr hash Alexander Aring
2016-03-23  9:58   ` Stefan Schmidt
2016-03-22 13:15 ` [RFC bluetooth-next 05/19] 6lowpan: change naming for lowpan private data Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 06/19] 6lowpan: move lowpan_802154_dev to 6lowpan Alexander Aring
2016-03-23 10:08   ` Stefan Schmidt
2016-03-22 13:15 ` [RFC bluetooth-next 07/19] 6lowpan: iphc: rename add lowpan prefix Alexander Aring
2016-03-23 10:09   ` Stefan Schmidt
2016-04-08 17:36     ` Marcel Holtmann
2016-04-11 17:00       ` Stefan Schmidt
2016-03-22 13:15 ` [RFC bluetooth-next 08/19] 6lowpan: iphc: remove unnecessary zero data Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 09/19] 6lowpan: move eui64 uncompress function Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 10/19] 6lowpan: add lowpan_is_ll function Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 11/19] 6lowpan: move mac802154 header Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 12/19] 6lowpan: add private neighbour data Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 13/19] addrconf: add 802.15.4 short addr slaac Alexander Aring
2016-03-23 10:50   ` Hannes Frederic Sowa [this message]
2016-04-05  8:20     ` Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 14/19] ndisc: add addr_len parameter to ndisc_opt_addr_space Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 15/19] ndisc: add addr_len parameter to ndisc_opt_addr_data Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 16/19] ndisc: add addr_len parameter to ndisc_fill_addr_option Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 17/19] ndisc: add short address to ndisc opts parsing Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 18/19] ndisc: add support for short address option Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 19/19] 6lowpan: add support for 802.15.4 short addr handling Alexander Aring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56F274E4.2050205@stressinduktion.org \
    --to=hannes@stressinduktion.org \
    --cc=aar@pengutronix.de \
    --cc=jukka.rissanen@linux.intel.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-wpan@vger.kernel.org \
    --cc=mcr@sandelman.ca \
    --cc=stefan@osg.samsung.com \
    --cc=werner@almesberger.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.