Skip to contentSkip to conversation

etherip: Ethernet-in-IPv4 tunneling

RFC PATCH In review Lennert Buytenhek 7 participants 30 messages Jan 12, 2005 – Jan 17, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 etherip: Ethernet-in-IPv4 tunneling

Hi,

After struggling with various userland VPN solutions for a while (and failing to make IPSEC tunnel mode do what I want), I decided to just implement ethernet-in-IP tunneling in the kernel and let IPSEC transport mode handle the rest.

There appeared to be an RFC for ethernet-in-IP already, RFC 3378, so I just implemented that. It's very simple -- slap a 16-bit header (0x3000, which is 4 bits of etherip version number and 12 bits of padding) onto the beginning of the ethernet packet, and then wrap it in an IP packet.

Below is what I came up with, against the latest Fedora Core 3 kernel, which is 2.6.10-something. It survives some fairly basic testing between a number of different machines, UP and SMP. (Corresponding iproute2 patch is available from http://www.wantstofly.org/~buytenh/etherip/ )

Notes:
- daddr=0 tunnel mode is meaningless for generic ethernet tunneling, so I didn't implement that. Packets are just dropped on the floor if daddr==0 at the time of sending, which is the default mode for the etherip0 device.

Issues and TODO:
- Implement MULTICAST(daddr) tunnel mode, seems useful to have.
- Perhaps we should always present a MTU=1500 device to the user and deal with fragmentation issues ourselves.
- Don't take TTL of outer packet from inner packet.
- Figure out what to do with DF.
- Check whether ECN bits are correctly {en,de}capsulated.
- Check out iffy-looking '2 * sizeof(struct etheriphdr)' construct (same problem in ip_gre.c?)

Comments? I would like to see this upstream when the remaining issues have been sorted out.

cheers,
Lennert

include/linux/in.h +1 -0
diff -urN linux-2.6.10.orig/include/linux/in.h linux-2.6.10/include/linux/in.h
@@ -39,6 +39,7 @@
 
   IPPROTO_ESP = 50,            /* Encapsulation Security Payload protocol */
   IPPROTO_AH = 51,             /* Authentication Header protocol       */
+  IPPROTO_ETHERIP = 97,		/* Ethernet-in-IP tunneling (rfc 3378)	*/
   IPPROTO_PIM    = 103,		/* Protocol Independent Multicast	*/
 
   IPPROTO_COMP   = 108,                /* Compression Header protocol */
net/ipv4/etherip.c +758 -0

758 lines not on this page · raw message

net/ipv4/Kconfig +9 -0
diff -urN linux-2.6.10.orig/net/ipv4/Kconfig linux-2.6.10/net/ipv4/Kconfig
@@ -202,6 +202,15 @@
 	  Network), but can be distributed all over the Internet. If you want
 	  to do that, say Y here and to "IP multicast routing" below.
 
+config NET_ETHERIP
+	tristate "IP: ethernet-in-IP tunneling"
+	depends on INET
+	help
+	  Tunneling means encapsulating data of one protocol type within
+	  another protocol and sending it over a channel that understands the
+	  encapsulating protocol. This particular tunneling driver implements
+	  the etherip Ethernet-in-IP protocol as described in RFC 3378.
+
 config IP_MROUTE
 	bool "IP: multicast routing"
 	depends on IP_MULTICAST
net/ipv4/Makefile +1 -0
diff -urN linux-2.6.10.orig/net/ipv4/Makefile linux-2.6.10/net/ipv4/Makefile
@@ -14,6 +14,7 @@
 obj-$(CONFIG_IP_MROUTE) += ipmr.o
 obj-$(CONFIG_NET_IPIP) += ipip.o
 obj-$(CONFIG_NET_IPGRE) += ip_gre.o
+obj-$(CONFIG_NET_ETHERIP) += etherip.o
 obj-$(CONFIG_SYN_COOKIES) += syncookies.o
 obj-$(CONFIG_INET_AH) += ah4.o
 obj-$(CONFIG_INET_ESP) += esp4.o
#1 lore raw
Quoted 33 lines · Lennert Buytenhek

Hi,

After struggling with various userland VPN solutions for a while (and failing to make IPSEC tunnel mode do what I want), I decided to just implement ethernet-in-IP tunneling in the kernel and let IPSEC transport mode handle the rest.

There appeared to be an RFC for ethernet-in-IP already, RFC 3378, so I just implemented that. It's very simple -- slap a 16-bit header (0x3000, which is 4 bits of etherip version number and 12 bits of padding) onto the beginning of the ethernet packet, and then wrap it in an IP packet.

Below is what I came up with, against the latest Fedora Core 3 kernel, which is 2.6.10-something. It survives some fairly basic testing between a number of different machines, UP and SMP. (Corresponding iproute2 patch is available from http://www.wantstofly.org/~buytenh/etherip/ )

Notes:
- daddr=0 tunnel mode is meaningless for generic ethernet tunneling, so I didn't implement that. Packets are just dropped on the floor if daddr==0 at the time of sending, which is the default mode for the etherip0 device.

Issues and TODO:
- Implement MULTICAST(daddr) tunnel mode, seems useful to have.
- Perhaps we should always present a MTU=1500 device to the user and deal with fragmentation issues ourselves.
- Don't take TTL of outer packet from inner packet.
- Figure out what to do with DF.
- Check whether ECN bits are correctly {en,de}capsulated.
- Check out iffy-looking '2 * sizeof(struct etheriphdr)' construct (same problem in ip_gre.c?)

Quoted 2 lines

Comments? I would like to see this upstream when the remaining issues have been sorted out.

Why do you add a single device when loading the module? Is this just so you have something to hook the ioctl to?

My personal preference would be something where you do not automatically create an etherip0, but would have an etherip-config tool or similar to create/destroy interfaces.

Also, could you add an ioctl that allowed one to query whether or not a particular device is an etherip device? I had always wished I had added this earlier to the VLAN code :)

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#2 lore raw
Quoted 6 lines · Ben Greear

Why do you add a single device when loading the module? Is this just so you have something to hook the ioctl to?

My personal preference would be something where you do not automatically create an etherip0, but would have an etherip-config tool or similar to create/destroy interfaces.

I modelled this after the way ipip/gre/sit do things -- they create tunl0/gre0/sit0, and have 'ip tunnel' send its ioctls to those devices.

I wouldn't mind changing this to another mechanism, but 1) we'd have to agree on a mechanism, and 2) we'd have to change the other tunnel types over to this mechanism as well.

Quoted 3 lines

Also, could you add an ioctl that allowed one to query whether or not a particular device is an etherip device? I had always wished I had added this earlier to the VLAN code :)

Hmmm. Bridge devices don't have this either, do they? Can you name an advantage of having this?

cheers,
Lennert

#3 lore raw
Quoted 11 lines · Lennert Buytenhek
Quoted 6 lines · Ben Greear

Why do you add a single device when loading the module? Is this just so you have something to hook the ioctl to?

My personal preference would be something where you do not automatically create an etherip0, but would have an etherip-config tool or similar to create/destroy interfaces.

Quoted 6 lines

I modelled this after the way ipip/gre/sit do things -- they create tunl0/gre0/sit0, and have 'ip tunnel' send its ioctls to those devices.

I wouldn't mind changing this to another mechanism, but 1) we'd have to agree on a mechanism, and 2) we'd have to change the other tunnel types over to this mechanism as well.

Ok, it's not a big deal to me.

Quoted 7 lines
Quoted 3 lines

Also, could you add an ioctl that allowed one to query whether or not a particular device is an etherip device? I had always wished I had added this earlier to the VLAN code :)

Hmmm. Bridge devices don't have this either, do they? Can you name an advantage of having this?

I got the request several times with regard to VLANs. Lots of people (and applications) will want to know the interface type for various reasons. If you don't give them a nice programatic thing like an IOCTL to call, they will undoubtedly start making assumptions based off of the device name...

Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#4 lore raw
Quoted 4 lines · Ben Greear
Quoted 4 lines
Quoted 3 lines

Also, could you add an ioctl that allowed one to query whether or not a particular device is an etherip device? I had always wished I had added this earlier to the VLAN code :)

Quoted 8 lines
Quoted 2 lines

Hmmm. Bridge devices don't have this either, do they? Can you name an advantage of having this?

I got the request several times with regard to VLANs. Lots of people (and applications) will want to know the interface type for various reasons. If you don't give them a nice programatic thing like an IOCTL to call, they will undoubtedly start making assumptions based off of the device name...

Makes sense..

Unfortunately SIOCGETTUNNEL is (SIOCDEVPRIVATE + 3), otherwise we could just say something like "If an ARPHRD_ETHER device supports SIOCGETTUNNEL, it's an ether/ip tunnel."

Any better ideas? I hate adding more ioctls.

cheers,
Lennert

#5 lore raw

* Lennert Buytenhek <[email protected]> 2005-01-13 00:16

Quoted 15 lines · Ben Greear
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

Also, could you add an ioctl that allowed one to query whether or not a particular device is an etherip device? I had always wished I had added this earlier to the VLAN code :)

Quoted 8 lines
Quoted 2 lines

Hmmm. Bridge devices don't have this either, do they? Can you name an advantage of having this?

I got the request several times with regard to VLANs. Lots of people (and applications) will want to know the interface type for various reasons. If you don't give them a nice programatic thing like an IOCTL to call, they will undoubtedly start making assumptions based off of the device name...

Quoted 7 lines

Makes sense..

Unfortunately SIOCGETTUNNEL is (SIOCDEVPRIVATE + 3), otherwise we could just say something like "If an ARPHRD_ETHER device supports SIOCGETTUNNEL, it's an ether/ip tunnel."

Any better ideas? I hate adding more ioctls.

I think it should go into ip_tunnel_param, unforunately there are no unused fields. Maybe schedule this for 2.7 together with a clean up of all the tunnels so they share redundant code? Lots of gre related code and comments spread over non-gre tunnels that should go away.

#6 lore raw
Quoted 15 lines · Thomas Graf
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

Also, could you add an ioctl that allowed one to query whether or not a particular device is an etherip device? I had always wished I had added this earlier to the VLAN code :)

Quoted 8 lines
Quoted 2 lines

Hmmm. Bridge devices don't have this either, do they? Can you name an advantage of having this?

I got the request several times with regard to VLANs. Lots of people (and applications) will want to know the interface type for various reasons. If you don't give them a nice programatic thing like an IOCTL to call, they will undoubtedly start making assumptions based off of the device name...

Makes sense..

Quoted 8 lines
Quoted 5 lines

Unfortunately SIOCGETTUNNEL is (SIOCDEVPRIVATE + 3), otherwise we could just say something like "If an ARPHRD_ETHER device supports SIOCGETTUNNEL, it's an ether/ip tunnel."

Any better ideas? I hate adding more ioctls.

I think it should go into ip_tunnel_param, unforunately there are no unused fields.

What's that? I can't find it in my kernel tree nor on google.

Quoted 3 lines

Maybe schedule this for 2.7 together with a clean up
of all the tunnels so they share redundant code? Lots of gre related code and comments spread over non-gre tunnels that should go away.

Indeed, it would be good to have this cleaned up.

cheers,
Lennert

#7 lore raw

* Lennert Buytenhek <[email protected]> 2005-01-13 01:18

Quoted 1 line

What's that? I can't find it in my kernel tree nor on google.

Typo, sorry. I meant ip_tunnel_parm. Thinking of it, shouldn't protocol in ip_tunnel_parm->iph->protocol be set to ETHER_IP so userspace could find out this way?

#8 lore raw
Quoted 5 lines · Thomas Graf
Quoted 1 line

What's that? I can't find it in my kernel tree nor on google.

Typo, sorry. I meant ip_tunnel_parm. Thinking of it, shouldn't protocol in ip_tunnel_parm->iph->protocol be set to ETHER_IP so userspace could find out this way?

ip_tunnel_parm->iph->protocol for ether/ip tunnels is IPPROTO_ETHERIP, which is 97. So yeah, the info is in there. But this doesn't help you much in determining whether an arbitrary network device is in fact an ether/ip tunnel or not, since SIOCGETTUNNEL aliases with SIOCDEVPRIVATE+3.

The only way to make it stand out would be to give it its own ARPHRD_ type, but then it wouldn't look like an ethernet device anymore.

cheers,
Lennert

#9 lore raw

* Lennert Buytenhek <[email protected]> 2005-01-13 01:36

Quoted 12 lines · Thomas Graf
Quoted 6 lines
Quoted 2 lines

What's that? I can't find it in my kernel tree nor on google.

Typo, sorry. I meant ip_tunnel_parm. Thinking of it, shouldn't protocol in ip_tunnel_parm->iph->protocol be set to ETHER_IP so userspace could find out this way?

ip_tunnel_parm->iph->protocol for ether/ip tunnels is IPPROTO_ETHERIP, which is 97. So yeah, the info is in there. But this doesn't help you much in determining whether an arbitrary network device is in fact an ether/ip tunnel or not, since SIOCGETTUNNEL aliases with SIOCDEVPRIVATE+3.

Ahh.. You want userspace to be able to tell even if it is unclear wether it is a tunnel. I think the only way to avoid a new ioctl would be to introduce IFF_TUNNEL or alike and have userspace call GETTUNNEL if it is set. This also solves the problem for all other tunnels. You can also reuse one of the unused flags such as IFF_NOTRAILERS since it would be read only anyway but I guess this would be too much of a hack ;->

#10 lore raw
In reply to Lennert Buytenhek
Quoted 17 lines · Lennert Buytenhek
Quoted 4 lines · Ben Greear
Quoted 4 lines
Quoted 3 lines

Also, could you add an ioctl that allowed one to query whether or not a particular device is an etherip device? I had always wished I had added this earlier to the VLAN code :)

Quoted 8 lines
Quoted 2 lines

Hmmm. Bridge devices don't have this either, do they? Can you name an advantage of having this?

I got the request several times with regard to VLANs. Lots of people (and applications) will want to know the interface type for various reasons. If you don't give them a nice programatic thing like an IOCTL to call, they will undoubtedly start making assumptions based off of the device name...

Quoted 7 lines

Makes sense..

Unfortunately SIOCGETTUNNEL is (SIOCDEVPRIVATE + 3), otherwise we could just say something like "If an ARPHRD_ETHER device supports SIOCGETTUNNEL, it's an ether/ip tunnel."

Any better ideas? I hate adding more ioctls.

How about add one IOCTL that takes a small (naturally packed/aligned, fixed-size!) struct that has within it an enumeration of specific commands and whatever fields are needed for arguments. Then you only need to add a single IOCTL to the system, and you can add more commands at will.

Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#11 lore raw
In reply to Lennert Buytenhek
Quoted 12 lines · On Wed, 12 Jan 2005 23:24:37 +0100 Lennert Buytenhek <[email protected]>…

Hi,

After struggling with various userland VPN solutions for a while (and failing to make IPSEC tunnel mode do what I want), I decided to just implement ethernet-in-IP tunneling in the kernel and let IPSEC transport mode handle the rest.

There appeared to be an RFC for ethernet-in-IP already, RFC 3378, so I just implemented that. It's very simple -- slap a 16-bit header (0x3000, which is 4 bits of etherip version number and 12 bits of padding) onto the beginning of the ethernet packet, and then wrap it in an IP packet.

Quoted 5 lines

Below is what I came up with, against the latest Fedora Core 3 kernel, which is 2.6.10-something. It survives some fairly basic testing between a number of different machines, UP and SMP. (Corresponding iproute2 patch is available from http://www.wantstofly.org/~buytenh/etherip/ )

Since it is an RFC, any chance of interoperability testing it with something besides Linux on the other end?

Signature · 1 line
Stephen Hemminger	<[email protected]>
#12 lore raw
Quoted 10 lines · Stephen Hemminger
Quoted 10 lines

After struggling with various userland VPN solutions for a while (and failing to make IPSEC tunnel mode do what I want), I decided to just implement ethernet-in-IP tunneling in the kernel and let IPSEC transport mode handle the rest.

There appeared to be an RFC for ethernet-in-IP already, RFC 3378, so I just implemented that. It's very simple -- slap a 16-bit header (0x3000, which is 4 bits of etherip version number and 12 bits of padding) onto the beginning of the ethernet packet, and then wrap it in an IP packet.

Quoted 7 lines
Quoted 4 lines

Below is what I came up with, against the latest Fedora Core 3 kernel, which is 2.6.10-something. It survives some fairly basic testing between a number of different machines, UP and SMP. (Corresponding iproute2 patch is available from http://www.wantstofly.org/~buytenh/etherip/ )

Since it is an RFC, any chance of interoperability testing it with something besides Linux on the other end?

Some googling suggests that OpenBSD implements this as well.

Anyone here with an OpenBSD box on the 'net that's willing to do some tests?

cheers,
Lennert

#13 lore raw
In reply to Lennert Buytenhek
Quoted 9 lines · Lennert Buytenhek

After struggling with various userland VPN solutions for a while (and failing to make IPSEC tunnel mode do what I want), I decided to just implement ethernet-in-IP tunneling in the kernel and let IPSEC transport mode handle the rest.

There appeared to be an RFC for ethernet-in-IP already, RFC 3378, so I just implemented that. It's very simple -- slap a 16-bit header (0x3000, which is 4 bits of etherip version number and 12 bits of padding) onto the beginning of the ethernet packet, and then wrap it in an IP packet.

EtherIP is not recommended for use; it's an Informational RFC.

Is there a particular reason why GRE tunnel is not sufficient? AFAICS, it provides all the benefits of Ethernet-in-IP, is very commonly deployed, and only has 4 bytes of overhead.

And if GRE is not sufficient, the next step would be L2TP.

Signature · 3 lines
Pekka Savola                 "You each name yourselves king, yet the
Netcore Oy                    kingdom bleeds."
Systems. Networks. Security. -- George R.R. Martin: A Clash of Kings
#14 lore raw
Quoted 1 line · Pekka Savola

Is there a particular reason why GRE tunnel is not sufficient?

No particular reason, apart from not being aware that GRE provides this functionality.

cheers,
Lennert

#15 lore raw
Quoted 6 lines · Lennert Buytenhek
Quoted 1 line · Pekka Savola

Is there a particular reason why GRE tunnel is not sufficient?

No particular reason, apart from not being aware that GRE provides this functionality.

True that GRE can do all this (and they have thought out well the broadcasting etc) but i dont think it will harm to push this into the kernel if some odd OS like openbsd supports it.

cheers,
jamal

#16 lore raw

tunneling in linux (was: Re: [PATCH][RFC] etherip: Ethernet-in-IPv4 tunneling)

Summarising private thread on netdev.

The main issue under discussion is whether to implement ethernet-over-IP tunneling by using etherip, or whether using something like GRE would be better. The main argument against etherip is that its RFC has 'Informational' status (while the latest GRE RFC I could find, 2784, is 'Proposed Standard'.)

Another argument against etherip would be that OpenBSD apparently mis-implemented etherip by putting the etherip version nibble in the second nibble of the etherip header instead of the first, which would probably prevent the linux and OpenBSD versions from interoperating, negating the advantage of using etherip in the first place.

All I personally care about is that when I install a random linux distro two years from now, that ethernet-over-IP tunneling will simply work, using whatever protocol -- I don't care about which.

Any opinions?

If we do end up using GRE for ethernet tunneling, there's some work that needs to be done. For one, ip_gre in its current form would need a certain amount of hacking for tunneling ethernet frames instead of IPv4/IPv6 as it does now. We might as rename it to plain 'gre' and move it out of net/ipv4/ to net/core/ or something while we're at it.

The way we currently use (f.e. in iproute2) for finding out whether a given netdevice is a tunnel or not is by looking at ARPHRD_*, but this scheme breaks down for ethernet tunnels, since there is no other way of distinguishing them from regular ethernet devices. We could issue SIOCGETTUNNEL and see if that succeeds, but that unfortunately aliases with SIOCDEVPRIVATE which aliases to BOND_ENSLAVE_OLD, SIOCGMSTATS, EQL_ENSLAVE, FRAD_GET_CONF, SIOCDEVPLIP, SIOCGPPPSTATS and a million others, so you never know if the netdevice really interpreted it as SIOCGETTUNNEL or no.

Other things that suck about tunneling?
- If we're going to overhaul the way tunneling works, we should try to remove the need for the gre0 interface as well.
- Tunneling over IPv6 should be implemented.
- How to share more code between sit/ipip/gre?

Ideas?

Quoted 13 lines · jamal
Quoted 4 lines
Quoted 1 line

Is there a particular reason why GRE tunnel is not sufficient?

No particular reason, apart from not being aware that GRE provides this functionality.

True that GRE can do all this (and they have thought out well the broadcasting etc) but i dont think it will harm to push this into the kernel if some odd OS like openbsd supports it.

cheers,
jamal

#17 lore raw

Re: tunneling in linux (was: Re: [PATCH][RFC] etherip: Ethernet-in-IPv4 tunneling)

Quoted 5 lines · Lennert Buytenhek

If we do end up using GRE for ethernet tunneling, there's some work that needs to be done. For one, ip_gre in its current form would need a certain amount of hacking for tunneling ethernet frames instead of IPv4/IPv6 as it does now. We might as rename it to plain 'gre' and move it out of net/ipv4/ to net/core/ or something while we're at it.

Now that I think about this a bit more, there may be a potential issue..

If the payload of GRE is an ethernet frame, which GRE 'Protocol Type' (i.e., ethertype) would that be?

I doubt anyone has defined an ethertype which would be used to transmit full ethernet frames inside an ethernet header, so this would likely need to be some special value..

http://www.iana.org/assignments/ethernet-numbers

(Another solution for this problem space is obviously L2TP, which is also rather widely supported..)

Signature · 3 lines
Pekka Savola                 "You each name yourselves king, yet the
Netcore Oy                    kingdom bleeds."
Systems. Networks. Security. -- George R.R. Martin: A Clash of Kings
#18 lore raw

Re: tunneling in linux (was: Re: [PATCH][RFC] etherip: Ethernet-in-IPv4 tunneling)

Quoted 11 lines · Pekka Savola
Quoted 5 lines

If we do end up using GRE for ethernet tunneling, there's some work that needs to be done. For one, ip_gre in its current form would need a certain amount of hacking for tunneling ethernet frames instead of IPv4/IPv6 as it does now. We might as rename it to plain 'gre' and move it out of net/ipv4/ to net/core/ or something while we're at it.

Now that I think about this a bit more, there may be a potential issue..

If the payload of GRE is an ethernet frame, which GRE 'Protocol Type' (i.e., ethertype) would that be?

I assumed that "Transparent Ethernet Bridging" would be used for that.

Quoted 1 line

From ethernet-numbers:

	Ethernet          Exp. Ethernet    Description          References
	-------------     -------------   -----------           ----------
	decimal  Hex      decimal  octal
	[snip]
	 25944   6558        -      -     Trans Ethen Bridging   [RFC1701]

RFC1701 is the original GRE RFC, which mentions:

The following are currently assigned protocol types for GRE. Future protocol types must be taken from DIX ethernet encoding. For historical reasons, a number of other values have been used for some protocols. The following table of values MUST be used to identify the following protocols:

Protocol Family PTYPE
--------------- -----
[snip]
Transparent Ethernet Bridging 6558

--L

#19 lore raw

Re: tunneling in linux (was: Re: [PATCH][RFC] etherip: Ethernet-in-IPv4 tunneling)

Quoted 3 lines · Lennert Buytenhek

I assumed that "Transparent Ethernet Bridging" would be used for that.

	 25944   6558        -      -     Trans Ethen Bridging   [RFC1701]

Yes. Sorry I missed that.

Signature · 3 lines
Pekka Savola                 "You each name yourselves king, yet the
Netcore Oy                    kingdom bleeds."
Systems. Networks. Security. -- George R.R. Martin: A Clash of Kings
#20 lore raw

Re: tunneling in linux (was: Re: [PATCH][RFC] etherip: Ethernet-in-IPv4 tunneling)

In reply to Lennert Buytenhek

On Sun, 2005-01-16 at 13:55, Lennert Buytenhek wrote:
[..]

Quoted 5 lines

Another argument against etherip would be that OpenBSD apparently mis-implemented etherip by putting the etherip version nibble in the second nibble of the etherip header instead of the first, which would probably prevent the linux and OpenBSD versions from interoperating, negating the advantage of using etherip in the first place.

Should be pretty easy for them to fix, no?

Quoted 6 lines

All I personally care about is that when I install a random linux distro two years from now, that ethernet-over-IP tunneling will simply work, using whatever protocol -- I don't care about which.

Any opinions?

My opinion is it doesnt harm to have it in. BTW, in one of your emails i noticed you cced the authors of that RFC - did they respond? Whats their deployment experiences?

Quoted 10 lines

If we do end up using GRE for ethernet tunneling, there's some work that needs to be done. For one, ip_gre in its current form would need a certain amount of hacking for tunneling ethernet frames instead of IPv4/IPv6 as it does now. We might as rename it to plain 'gre' and move it out of net/ipv4/ to net/core/ or something while we're at it.

The way we currently use (f.e. in iproute2) for finding out whether a given netdevice is a tunnel or not is by looking at ARPHRD_*, but this scheme breaks down for ethernet tunnels,

the dev->type is intended precisely for that. So if this needs a new type then you should introduce a new ARPHRD type for it and set it at device creation time.

Quoted 7 lines

since there is no other way of
distinguishing them from regular ethernet devices. We could issue SIOCGETTUNNEL and see if that succeeds, but that unfortunately aliases with SIOCDEVPRIVATE which aliases to BOND_ENSLAVE_OLD, SIOCGMSTATS, EQL_ENSLAVE, FRAD_GET_CONF, SIOCDEVPLIP, SIOCGPPPSTATS and a million others, so you never know if the netdevice really interpreted it as SIOCGETTUNNEL or no.

Introducing the new type should help. Also the iflink is typically set to the mother netdevice. So that should go a long way to give you details.
Ia m not sure about this ioctl stuff - but shouldnt there be a backway via netlink for all these details.

Quoted 3 lines

Other things that suck about tunneling?
- If we're going to overhaul the way tunneling works, we should try to remove the need for the gre0 interface as well.

Why is this first instance needed? Its not like theres a bus that is scanned at boot time and we need to create at that discovery time.

Quoted 1 line

- Tunneling over IPv6 should be implemented.

sit? or v6-v6?

Quoted 1 line

- How to share more code between sit/ipip/gre?

Lots of shareable stuff there.

BTW, have you looked at any of the L2VPN stuff? browse the ietf web page. Some interesting stuff there.

cheers,
jamal

#21 lore raw

Re: tunneling in linux (was: Re: [PATCH][RFC] etherip: Ethernet-in-IPv4 tunneling)

Quoted 7 lines · jamal
Quoted 5 lines

Another argument against etherip would be that OpenBSD apparently mis-implemented etherip by putting the etherip version nibble in the second nibble of the etherip header instead of the first, which would probably prevent the linux and OpenBSD versions from interoperating, negating the advantage of using etherip in the first place.

Should be pretty easy for them to fix, no?

Sure, but, the argument in favor of etherip would be interoperability with existing implementations. If at least OpenBSD gets it wrong (and the proposed patch for NetBSD seems to also use the wrong value) then this argument isn't all that strong anymore.

Quoted 7 lines
Quoted 5 lines

All I personally care about is that when I install a random linux distro two years from now, that ethernet-over-IP tunneling will simply work, using whatever protocol -- I don't care about which.

Any opinions?

My opinion is it doesnt harm to have it in.

We'd need to sort out the ARPHRD_* issue in any case -- see below.

Quoted 3 lines

BTW, in one of your emails i
noticed you cced the authors of that RFC - did they respond? Whats their deployment experiences?

The @rsa.. address bounces, the other address is still in the CC list and I didn't hear from him yet :-)

Quoted 6 lines
Quoted 6 lines

If we do end up using GRE for ethernet tunneling, there's some work that needs to be done. For one, ip_gre in its current form would need a certain amount of hacking for tunneling ethernet frames instead of IPv4/IPv6 as it does now. We might as rename it to plain 'gre' and move it out of net/ipv4/ to net/core/ or something while we're at it.

Quoted 7 lines
Quoted 3 lines

The way we currently use (f.e. in iproute2) for finding out whether a given netdevice is a tunnel or not is by looking at ARPHRD_*, but this scheme breaks down for ethernet tunnels,

the dev->type is intended precisely for that. So if this needs a new type then you should introduce a new ARPHRD type for it and set it at device creation time.

Bridges present themselves as ARPHRD_ETHER, even though they are not 'real' ethernet devices as such. Should they have their own type? What about ethertap devices?

If we create ARPHRD_ETHERTUNNEL for ethernet tunnels instead of using ARPHRD_ETHER, we'd have to make modifications all over the place to teach other code that ARPHRD_ETHERTUNNEL is basically just another type of ethernet device. For example, we'd have to modify net/bridge/* because it will only enslave devices which are ARPHRD_ETHER. But even more modifications would be needed in userland -- we'd have to adapt ifconfig, ip route, etc.

The issue is "We can not blindly issue SIOCGETTUNNEL to ARPHRD_ETHER devices like we do for ARPHRD_{TUNNEL,IPGRE,SIT} because on _ETHER, it might alias with another ioctl (SIOCDEVPRIVATE)."

Quoted 11 lines
Quoted 7 lines

since there is no other way of
distinguishing them from regular ethernet devices. We could issue SIOCGETTUNNEL and see if that succeeds, but that unfortunately aliases with SIOCDEVPRIVATE which aliases to BOND_ENSLAVE_OLD, SIOCGMSTATS, EQL_ENSLAVE, FRAD_GET_CONF, SIOCDEVPLIP, SIOCGPPPSTATS and a million others, so you never know if the netdevice really interpreted it as SIOCGETTUNNEL or no.

Introducing the new type should help. Also the iflink is typically set to the mother netdevice. So that should go a long way to give you details.

There is no 'mother' device for a tunnel -- there might be no route to the remote host at creation time, and that route might change over time due to routing changes too.

Quoted 6 lines
Quoted 3 lines

Other things that suck about tunneling?
- If we're going to overhaul the way tunneling works, we should try to remove the need for the gre0 interface as well.

Why is this first instance needed? Its not like theres a bus that is scanned at boot time and we need to create at that discovery time.

This first instance is used for sending ioctls to to create subsequent tunnel devices. Doing something netlink-based would be fine with me.

Quoted 3 lines
Quoted 1 line

- Tunneling over IPv6 should be implemented.

sit? or v6-v6?

Basically, 'ip tunnel' should accept v6 addresses for 'local' and 'remote'. Having GRE-over-v6 would then imply v6-over-v6, v4-over-v6, ethernet-over-v6, etc.

Quoted 2 lines

BTW, have you looked at any of the L2VPN stuff? browse the ietf web page. Some interesting stuff there.

The L2TP RFC (RFC 2661, is that the same thing?) is 170kB, which scared me off somewhat.

At least the GRE RFC fits in 16kB.

--L

#22 lore raw

Re: tunneling in linux (was: Re: [PATCH][RFC] etherip: Ethernet-in-IPv4 tunneling)

Quoted 6 lines · Lennert Buytenhek
Quoted 2 lines · jamal

BTW, have you looked at any of the L2VPN stuff? browse the ietf web page. Some interesting stuff there.

The L2TP RFC (RFC 2661, is that the same thing?) is 170kB, which scared me off somewhat.

If L2TP, then v3 probably - RFC3931. But that's far from just ethernet over ip, it's anything over ip.

Signature · 3 lines
Hasso Tepper
Elion Enterprises Ltd.
WAN administrator
#23 lore raw

Re: tunneling in linux (was: Re: [PATCH][RFC] etherip: Ethernet-in-IPv4 tunneling)

Quoted 7 lines · Hasso Tepper
Quoted 5 lines
Quoted 2 lines

BTW, have you looked at any of the L2VPN stuff? browse the ietf web page. Some interesting stuff there.

The L2TP RFC (RFC 2661, is that the same thing?) is 170kB, which scared me off somewhat.

If L2TP, then v3 probably - RFC3931.

That RFC appears not to exist.

Quoted 1 line

But that's far from just ethernet over ip, it's anything over ip.

Yeah, I really doubt that L2TP is what I'm after.

--L

#24 lore raw

Re: tunneling in linux (was: Re: [PATCH][RFC] etherip: Ethernet-in-IPv4 tunneling)

Quoted 10 lines · Lennert Buytenhek
Quoted 7 lines · Hasso Tepper
Quoted 5 lines
Quoted 2 lines

BTW, have you looked at any of the L2VPN stuff? browse the ietf web page. Some interesting stuff there.

The L2TP RFC (RFC 2661, is that the same thing?) is 170kB, which scared me off somewhat.

If L2TP, then v3 probably - RFC3931.

That RFC appears not to exist.

Hmmm. Yes, seems that there was decision for yet another draft before 3931 was made official. Some sites contain info about it though. So official one at the moment:

http://www.ietf.org/internet-drafts/draft-ietf-l2tpext-l2tp-base-15.txt

Signature · 3 lines
Hasso Tepper
Elion Enterprises Ltd.
WAN administrator
#25 lore raw

Re: tunneling in linux (was: Re: [PATCH][RFC] etherip: Ethernet-in-IPv4 tunneling)

Quoted 8 lines · Hasso Tepper
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

BTW, have you looked at any of the L2VPN stuff? browse the ietf web page. Some interesting stuff there.

The L2TP RFC (RFC 2661, is that the same thing?) is 170kB, which scared me off somewhat.

If L2TP, then v3 probably - RFC3931.

Quoted 7 lines
Quoted 1 line

That RFC appears not to exist.

Hmmm. Yes, seems that there was decision for yet another draft before 3931 was made official. Some sites contain info about it though. So official one at the moment:

http://www.ietf.org/internet-drafts/draft-ietf-l2tpext-l2tp-base-15.txt

Things like this make me shiver:

<quote>
Appendix A: Control Slow Start and Congestion Avoidance

Although each side has indicated the maximum size of its receive window, it is recommended that a slow start and congestion avoidance method be used to transmit control packets. The methods described here are based upon the TCP congestion avoidance algorithm as described in Section 21.6 of TCP/IP Illustrated, Volume I, by W. Richard Stevens [STEVENS] (this algorithm is also described in [RFC2581]).

[snip]
</quote>

For some reason, people really really like reinventing TCP.

I'm definitely not going to implement this, all I wanted from the very beginning is a _simple_ way of tunneling ethernet packets. :-)

--L

#26 lore raw

Re: tunneling in linux (was: Re: [PATCH][RFC] etherip: Ethernet-in-IPv4 tunneling)

In reply to Lennert Buytenhek
Quoted 7 lines · Lennert Buytenhek

On Sun, Jan 16, 2005 at 03:02:26PM -0500, jamal wrote:

Sure, but, the argument in favor of etherip would be interoperability with existing implementations. If at least OpenBSD gets it wrong (and the proposed patch for NetBSD seems to also use the wrong value) then this argument isn't all that strong anymore.

Is 0x300 owned by anything? Maybe thats what it should be from now on and an update to be issued agains the RFC ;->

Quoted 6 lines
Quoted 3 lines

BTW, in one of your emails i
noticed you cced the authors of that RFC - did they respond? Whats their deployment experiences?

The @rsa.. address bounces, the other address is still in the CC list and I didn't hear from him yet :-)

Hopefully we'll hear from them

Quoted 6 lines
Quoted 3 lines

the dev->type is intended precisely for that. So if this needs a new type then you should introduce a new ARPHRD type for it and set it at device creation time.

Bridges present themselves as ARPHRD_ETHER, even though they are not 'real' ethernet devices as such. Should they have their own type?

some devices are "ethernet like" - meaning they operate on ethernet headers, so its fine to use that. I would think bridges would fall under that category.

Quoted 1 line

What about ethertap devices?

They are ethernet like as well. OTOH, if you look at tuntap you may find one of the modes is not ethernet-like. Infact it doesnt have a header at all;-> (ARPHRD_NONE). rule of thumb: Whats the header like?

Quoted 4 lines

If we create ARPHRD_ETHERTUNNEL for ethernet tunnels instead of using ARPHRD_ETHER, we'd have to make modifications all over the place to teach other code that ARPHRD_ETHERTUNNEL is basically just another type of ethernet device.

IANA actually keeps track of these iftype numbers - they dont seem to match with Linux - I wonder why we havent heard some SNMP weenie bitching about this:
http://www.iana.org/assignments/ianaiftype-mib
So, yes, should be able to add ARPHRD_ETHERTUNNEL in some free number and i am pretty sure youd hear from them someday;->
If i have time i will sneak a look at net-snmp

Quoted 4 lines

For example, we'd have to modify net/bridge/*
because it will only enslave devices which are ARPHRD_ETHER. But even more modifications would be needed in userland -- we'd have to adapt ifconfig, ip route, etc.

You probably want net/bridge to enslave _only_ ethernet like type netdevices. Otherwise it gets confused trying to see where the fsck dst MAC is to be found.

Quoted 3 lines

The issue is "We can not blindly issue SIOCGETTUNNEL to ARPHRD_ETHER devices like we do for ARPHRD_{TUNNEL,IPGRE,SIT} because on _ETHER, it might alias with another ioctl (SIOCDEVPRIVATE)."

I dont think it will be an issue with proper dev->type.

You know theres another way to do this:
Write this as a simple action. If all you are doing is slapping headers back and forth then you want:

ingress:

	match protocol 0x3000
		action: etherip decap, format, --> netif_rx

egress:

outgoing:

	match someIP
		action: etherip encap, format --> out we go

All very simple to control with netlink. And would be an excuse to finaly get you to look at this stuff ;->

Quoted 8 lines
Quoted 3 lines

Introducing the new type should help. Also the iflink is typically set to the mother netdevice. So that should go a long way to give you details.

There is no 'mother' device for a tunnel -- there might be no route to the remote host at creation time, and that route might change over time due to routing changes too.

I thought you should be able to specify _exactly_ what the physical device is ("ip tunnel ... dev eth0" or something along those lines) . I could be wrong.

Quoted 6 lines
Quoted 2 lines

Why is this first instance needed? Its not like theres a bus that is scanned at boot time and we need to create at that discovery time.

This first instance is used for sending ioctls to to create subsequent tunnel devices. Doing something netlink-based would be fine with me.

Yes, that would kill need for those devices.. 2.6.x is now fine and should handle all that fine with no need for ioctls - backward comapt maybe an issue.

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

- Tunneling over IPv6 should be implemented.

sit? or v6-v6?

Basically, 'ip tunnel' should accept v6 addresses for 'local' and 'remote'. Having GRE-over-v6 would then imply v6-over-v6, v4-over-v6, ethernet-over-v6, etc.

At the moment you specify the mode - is that the only painful thing? Didnt quiet follow

Quoted 8 lines
Quoted 3 lines

BTW, have you looked at any of the L2VPN stuff? browse the ietf web page. Some interesting stuff there.

The L2TP RFC (RFC 2661, is that the same thing?) is 170kB, which scared me off somewhat.

At least the GRE RFC fits in 16kB.

No meant L2VPNs - purely layer 2 and then somewhere along the path carried by MPLS.
start here: http://www.ietf.org/html.charters/l2vpn-charter.html

cheers,
jamal

#27 lore raw
In reply to jamal
Quoted 8 lines · jamal
Quoted 4 lines
Quoted 1 line

Is there a particular reason why GRE tunnel is not sufficient?

No particular reason, apart from not being aware that GRE provides this functionality.

True that GRE can do all this (and they have thought out well the broadcasting etc) but i dont think it will harm to push this into the kernel if some odd OS like openbsd supports it.

Apparently they mis-read the RFC and write the etherip header as 0x0300 instead of 0x3000 (they have the version nibble in the wrong place.) This would likely prevent interoperability.

cheers,
Lennert

#28 lore raw
Quoted 3 lines · Lennert Buytenhek

Apparently they mis-read the RFC and write the etherip header as 0x0300 instead of 0x3000 (they have the version nibble in the wrong place.) This would likely prevent interoperability.

Thinking about it a bit - you should be able to break yours to do 0x0300 to test with them ;->

cheers,
jamal

#29 lore raw
Quoted 6 lines · jamal
Quoted 3 lines

Apparently they mis-read the RFC and write the etherip header as 0x0300 instead of 0x3000 (they have the version nibble in the wrong place.) This would likely prevent interoperability.

Thinking about it a bit - you should be able to break yours to do 0x0300 to test with them ;->

Etherip is a really simple standard, the header is only 16 bits which can only assume a single value (0x3000). Looking at encapsulated packets with tcpdump makes me 99.99% confident that it's all okay on that level.

--L