Skip to contentSkip to conversation

Implement --passtos for tagged ethernet frames

PATCH In review David Sommerseth 1 participant 2 messages Feb 28, 2010 – Mar 10, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Implement --passtos for tagged ethernet frames

From: Davide Guerri <[email protected]...>

This patch makes it possible to use the --passtos option with 802.1Q tagged ethernet frames.

sf.net tracker:
<https://sourceforge.net/tracker/?func=detail&aid=2829878&group_id=48978&atid=454721>

---
 proto.c |   14 +++++++++++---
 proto.h |   12 ++++++++++++
 2 files changed, 23 insertions(+), 3 deletions(-)
proto.c +11 -3
index 72a3c6b..1f582ce 100644
@@ -53,9 +53,17 @@ is_ipv4 (int tunnel_type, struct buffer *buf)
 	  + sizeof (struct openvpn_iphdr)))
 	return false;
       eh = (const struct openvpn_ethhdr *) BPTR (buf);
-      if (ntohs (eh->proto) != OPENVPN_ETH_P_IPV4)
-	return false;
-      offset = sizeof (struct openvpn_ethhdr);
+      if (ntohs (eh->proto) == OPENVPN_ETH_P_8021Q) {
+        const struct openvpn_8021qhdr *evh;
+        evh = (const struct openvpn_8021qhdr *) BPTR (buf);
+        if (ntohs (evh->proto) != OPENVPN_ETH_P_IPV4)
+          return false;
+        else
+          offset = sizeof (struct openvpn_8021qhdr);
+      } else if (ntohs (eh->proto) != OPENVPN_ETH_P_IPV4)
+        return false;
+      else
+        offset = sizeof (struct openvpn_ethhdr);
     }
   else
     return false;
proto.h +12 -0
index f26fc8c..628e991 100644
@@ -64,6 +64,18 @@ struct openvpn_ethhdr
   uint16_t proto;                     /* packet type ID field */
 };
 
+# define OPENVPN_ETH_P_8021Q  0x8100  /* 802.1Q protocol */
+
+struct openvpn_8021qhdr
+{
+  uint8_t dest[OPENVPN_ETH_ALEN];     /* destination ethernet addr */
+  uint8_t source[OPENVPN_ETH_ALEN];   /* source ethernet addr	*/
+
+  uint32_t tag;                       /* packet 802.1Q Vlan Tag */
+  uint16_t proto;                     /* packet type ID field */
+};
+
+
 struct openvpn_arp {
 # define ARP_MAC_ADDR_TYPE 0x0001
   uint16_t mac_addr_type;       /* 0x0001 */
Signature · 1 line
1.6.6.1
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 5 lines · David Sommerseth

From: Davide Guerri <[email protected]...>

This patch makes it possible to use the --passtos option with 802.1Q tagged ethernet frames.

Quoted 9 lines

sf.net tracker:
<https://sourceforge.net/tracker/?func=detail&aid=2829878&group_id=48978&atid=454721>

---
 proto.c |   14 +++++++++++---
 proto.h |   12 ++++++++++++
 2 files changed, 23 insertions(+), 3 deletions(-)

Patch accepted for testing before getting merged into allmerged. The patch is available in the feat_passtos branch in the openvpn-testing.git tree.

Web view:
<http://openvpn.git.sourceforge.net/git/gitweb.cgi?p=openvpn/openvpn-testing.git;a=shortlog;h=refs/heads/feat_passtos>

Snapshot for testing:
<http://openvpn.git.sourceforge.net/git/gitweb.cgi?p=openvpn/openvpn-testing.git;a=snapshot;h=64ce035b40298e4d00a3e4767ce5386a2f937d9e;sf=tgz>

To use this snapshot, unpack it and run:

autoreconf -vi
./configure
make

** NOTE ** NOTE ** NOTE ** NOTE ** NOTE ** NOTE ** NOTE ** NOTE **

It is crucially important that this patch is tested by people who need this feature. This patch will be dropped if there are no response from testers.

kind regards,

David Sommerseth

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkuXwWsACgkQDC186MBRfrp2fgCfcb8hIfy1hGqquF3+VJ377DOU iqMAn2wrqg9iO+yYeYlV0hutooEtNe/4
=ECQJ
-----END PGP SIGNATURE-----