[PATCH 0/2] Add support for ARPHRD_RAWIP

STALE4667d

8 messages, 4 authors, 2013-10-31 · open the first message on its own page

[PATCH 0/2] Add support for ARPHRD_RAWIP

From: Jukka Rissanen <hidden>
Date: 2013-10-30 09:11:13

Hi,

This new type is needed in Bluetooth 6LoWPAN where
raw IPv6 packets are transferred to/from the device.

I used the same value (530) as some Android kernels
(from Qualcomm) are using in order not to brake any
user space programs. If this is not needed, I can
certainly send a new patch version with next available
value (519).

Cheers,
Jukka


Jukka Rissanen (2):
  net: if_arp: add ARPHRD_RAWIP type
  ipv6: Add checks for RAWIP ARP type

 include/uapi/linux/if_arp.h |  1 +
 net/ipv6/addrconf.c         | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

-- 
1.7.11.7

[PATCH 1/2] net: if_arp: add ARPHRD_RAWIP type

From: Jukka Rissanen <hidden>
Date: 2013-10-30 09:11:14

This is used when there is no L2 header before IP header.
Example of this is Bluetooth 6LoWPAN network.

The RAWIP header type value is already used in some Android kernels
so same value is used here in order not to break userspace.

Signed-off-by: Jukka Rissanen <redacted>
---
 include/uapi/linux/if_arp.h | 1 +
 1 file changed, 1 insertion(+)
diff --git a/include/uapi/linux/if_arp.h b/include/uapi/linux/if_arp.h
index d7fea34..06fc69f 100644
--- a/include/uapi/linux/if_arp.h
+++ b/include/uapi/linux/if_arp.h
@@ -59,6 +59,7 @@
 #define ARPHRD_LAPB	516		/* LAPB				*/
 #define ARPHRD_DDCMP    517		/* Digital's DDCMP protocol     */
 #define ARPHRD_RAWHDLC	518		/* Raw HDLC			*/
+#define ARPHRD_RAWIP	530	        /* Raw IP                       */
 
 #define ARPHRD_TUNNEL	768		/* IPIP tunnel			*/
 #define ARPHRD_TUNNEL6	769		/* IP6IP6 tunnel       		*/
-- 
1.7.11.7

[PATCH 2/2] ipv6: Add checks for RAWIP ARP type

From: Jukka Rissanen <hidden>
Date: 2013-10-30 09:11:16

Signed-off-by: Jukka Rissanen <redacted>
---
 net/ipv6/addrconf.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index d6ff126..60bf947 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1783,6 +1783,15 @@ static int addrconf_ifid_ip6tnl(u8 *eui, struct net_device *dev)
 	return 0;
 }
 
+static int addrconf_ifid_rawip(u8 *eui, struct net_device *dev)
+{
+	if (dev->addr_len != 8)
+		return -1;
+	memcpy(eui, dev->dev_addr, 8);
+	eui[0] ^= 2;
+	return 0;
+}
+
 static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
 {
 	switch (dev->type) {
@@ -1803,6 +1812,8 @@ static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
 		return addrconf_ifid_ieee1394(eui, dev);
 	case ARPHRD_TUNNEL6:
 		return addrconf_ifid_ip6tnl(eui, dev);
+	case ARPHRD_RAWIP:
+		return addrconf_ifid_rawip(eui, dev);
 	}
 	return -1;
 }
@@ -2681,7 +2692,8 @@ static void addrconf_dev_config(struct net_device *dev)
 	    (dev->type != ARPHRD_INFINIBAND) &&
 	    (dev->type != ARPHRD_IEEE802154) &&
 	    (dev->type != ARPHRD_IEEE1394) &&
-	    (dev->type != ARPHRD_TUNNEL6)) {
+	    (dev->type != ARPHRD_TUNNEL6) &&
+	    (dev->type != ARPHRD_RAWIP)) {
 		/* Alas, we support only Ethernet autoconfiguration. */
 		return;
 	}
-- 
1.7.11.7

Re: [PATCH 2/2] ipv6: Add checks for RAWIP ARP type

From: Alexander Aring <alex.aring@gmail.com>
Date: 2013-10-30 09:31:45

Hi Jukka,

On Wed, Oct 30, 2013 at 11:11:11AM +0200, Jukka Rissanen wrote:
quoted hunk
Signed-off-by: Jukka Rissanen <redacted>
---
 net/ipv6/addrconf.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index d6ff126..60bf947 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1783,6 +1783,15 @@ static int addrconf_ifid_ip6tnl(u8 *eui, struct net_device *dev)
 	return 0;
 }
 
+static int addrconf_ifid_rawip(u8 *eui, struct net_device *dev)
+{
+	if (dev->addr_len != 8)
+		return -1;
+	memcpy(eui, dev->dev_addr, 8);
+	eui[0] ^= 2;
+	return 0;
+}
+
I think we have already a function like this, look for:

static int addrconf_ifid_eui64(u8 *eui, struct net_device *dev)

which is the same for ieee802154 6lowpan. Are there any issues why we
can't use the same function here?

- Alex

Re: [PATCH 2/2] ipv6: Add checks for RAWIP ARP type

From: Jukka Rissanen <hidden>
Date: 2013-10-30 10:15:25

Hi Alexander,

On 30.10.2013 11:31, Alexander Aring wrote:
Hi Jukka,

On Wed, Oct 30, 2013 at 11:11:11AM +0200, Jukka Rissanen wrote:
quoted
Signed-off-by: Jukka Rissanen <redacted>
---
  net/ipv6/addrconf.c | 14 +++++++++++++-
  1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index d6ff126..60bf947 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1783,6 +1783,15 @@ static int addrconf_ifid_ip6tnl(u8 *eui, struct net_device *dev)
  	return 0;
  }

+static int addrconf_ifid_rawip(u8 *eui, struct net_device *dev)
+{
+	if (dev->addr_len != 8)
+		return -1;
+	memcpy(eui, dev->dev_addr, 8);
+	eui[0] ^= 2;
+	return 0;
+}
+
I think we have already a function like this, look for:

static int addrconf_ifid_eui64(u8 *eui, struct net_device *dev)

which is the same for ieee802154 6lowpan. Are there any issues why we
can't use the same function here?
No issues there, I can certainly prepare a patch that uses the 
addrconf_ifid_eui64() instead.


-- 
Cheers,
Jukka

Re: [PATCH 1/2] net: if_arp: add ARPHRD_RAWIP type

From: David Miller <davem@davemloft.net>
Date: 2013-10-30 21:25:57

From: Jukka Rissanen <redacted>
Date: Wed, 30 Oct 2013 11:11:10 +0200
This is used when there is no L2 header before IP header.
Example of this is Bluetooth 6LoWPAN network.

The RAWIP header type value is already used in some Android kernels
so same value is used here in order not to break userspace.

Signed-off-by: Jukka Rissanen <redacted>
I'm not applying patches like this until there is an actual user,
and this therefore goes for patch #2 as well.

Re: [PATCH 1/2] net: if_arp: add ARPHRD_RAWIP type

From: Marcel Holtmann <marcel@holtmann.org>
Date: 2013-10-30 22:26:42

Hi Dave,
quoted
This is used when there is no L2 header before IP header.
Example of this is Bluetooth 6LoWPAN network.

The RAWIP header type value is already used in some Android kernels
so same value is used here in order not to break userspace.

Signed-off-by: Jukka Rissanen <redacted>
I'm not applying patches like this until there is an actual user,
and this therefore goes for patch #2 as well.
patches for Bluetooth 6loWPAN have been posted to linux-bluetooth for review. So there is an actual user here.

If you do not want to merge these patches at this point, that is totally fine. We can happily carry them through bluetooth-next and wireless-next trees as well.

Posting them on netdev is mainly for checking that the changes we have to make outside the Bluetooth subsystem are in sync. So that they are reviewed and have been seen before. If you have any general objections to these assignments or changes, please let us now.

Regards

Marcel

Re: [PATCH 1/2] net: if_arp: add ARPHRD_RAWIP type

From: David Miller <davem@davemloft.net>
Date: 2013-10-31 04:27:27

From: Marcel Holtmann <marcel@holtmann.org>
Date: Wed, 30 Oct 2013 23:26:37 +0100
Posting them on netdev is mainly for checking that the changes we
have to make outside the Bluetooth subsystem are in sync.
Changes without use context and examples cannot be reviewed.

You have to provide those example users here, not on some external
list for us to look at.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help