[ipxe-devel] [PATCH 2/2] [vlan] Support VLAN 0 priority tagging
Ladi Prosek
lprosek at redhat.com
Fri Apr 15 16:19:48 UTC 2016
iPXE was unable to receive 802.1Q priority tagged packets even
with VLAN support turned on. These packets are specified in the
802.1Q standard and are supported by all major networking stacks.
With this commit the 802.1Q header is simply stripped off and
the packet is forwarded to a protocol based on the now off-set
EtherType field. For maximum compatibility this is done only
if VLAN 0 has not been explicitly configured.
A new config option VLAN0_PRIORITY is added and enabled in all
builds by default.
Signed-off-by: Ladi Prosek <lprosek at redhat.com>
---
src/config/config.c | 7 +++++++
src/config/general.h | 6 ++++++
src/net/vlan_protocol.c | 16 ++++++++++++----
3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/src/config/config.c b/src/config/config.c
index 6f9e66c..1094c1b 100644
--- a/src/config/config.c
+++ b/src/config/config.c
@@ -344,3 +344,10 @@ REQUIRE_OBJECT ( vram_settings );
#define REQUIRE_KEYMAP_OBJECT( _map ) REQUIRE_OBJECT ( keymap_ ## _map )
#define REQUIRE_KEYMAP( _map ) REQUIRE_KEYMAP_OBJECT ( _map )
REQUIRE_KEYMAP ( KEYBOARD_MAP );
+
+/*
+ * Drag in vlan_protocol for VLAN 0 priority tagging support
+ */
+ #ifdef VLAN0_PRIORITY
+ REQUIRE_OBJECT ( vlan_protocol );
+ #endif
diff --git a/src/config/general.h b/src/config/general.h
index 675c11e..b6c1189 100644
--- a/src/config/general.h
+++ b/src/config/general.h
@@ -168,6 +168,12 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#undef ERRMSG_80211 /* All 802.11 error descriptions (~3.3kb) */
/*
+ * Support VLAN 0 priority tagged packets even if VLAN_CMD is not defined
+ *
+ */
+#define VLAN0_PRIORITY
+
+/*
* Obscure configuration options
*
* You probably don't need to touch these.
diff --git a/src/net/vlan_protocol.c b/src/net/vlan_protocol.c
index 3b41cee..8ea1c52 100644
--- a/src/net/vlan_protocol.c
+++ b/src/net/vlan_protocol.c
@@ -72,11 +72,19 @@ static int vlan_rx ( struct io_buffer *iobuf, struct net_device *trunk,
/* Identify VLAN device */
tag = VLAN_TAG ( ntohs ( vlanhdr->tci ) );
netdev = vlan_find ( trunk, tag );
+
if ( ! netdev ) {
- DBGC2 ( trunk, "VLAN %s received packet for unknown VLAN "
- "%d\n", trunk->name, tag );
- rc = -EPIPE;
- goto err_no_vlan;
+ if ( tag == 0 ) {
+ /* This is a VLAN 0 priority tagged packet, deliver it
+ * to the trunk device.
+ */
+ netdev = trunk;
+ } else {
+ DBGC2 ( trunk, "VLAN %s received packet for unknown VLAN "
+ "%d\n", trunk->name, tag );
+ rc = -EPIPE;
+ goto err_no_vlan;
+ }
}
/* Strip VLAN header and preserve original link-layer header fields */
--
2.5.5
More information about the ipxe-devel
mailing list