aboutsummaryrefslogtreecommitdiffstats
path: root/vnet/vnet/gre/gre.c
diff options
context:
space:
mode:
authorDavid Hotham <david.hotham@metaswitch.com>2016-09-19 09:55:07 -0700
committerJohn Lo <loj@cisco.com>2016-09-19 19:01:59 +0000
commita8cd30937e5dc8a3bf629e1ee667550e267e5651 (patch)
treeafdc2648efdb29bf6e0dde24aa581041c88b46cf /vnet/vnet/gre/gre.c
parent16b7aaafac0bd06a9c330457eea9f6f674906606 (diff)
Add support for transparent ethernet bridging to GRE
Change-Id: Iaa3cefe223eb48b128893029a17e092b72a5157c Signed-off-by: David Hotham <david.hotham@metaswitch.com>
Diffstat (limited to 'vnet/vnet/gre/gre.c')
-rw-r--r--vnet/vnet/gre/gre.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/vnet/vnet/gre/gre.c b/vnet/vnet/gre/gre.c
index 6d375159..f00977c8 100644
--- a/vnet/vnet/gre/gre.c
+++ b/vnet/vnet/gre/gre.c
@@ -283,17 +283,25 @@ gre_interface_tx (vlib_main_t * vm,
vnet_buffer (b0)->sw_if_index[VLIB_TX] = t->outer_fib_index;
vnet_buffer (b1)->sw_if_index[VLIB_TX] = t->outer_fib_index;
- ip0 = vlib_buffer_get_current (b0);
- gre_protocol0 = clib_net_to_host_u16 (0x800);
- gre_protocol0 =
- ((ip0->ip_version_and_header_length & 0xF0) == 0x60) ?
- 0x86DD : gre_protocol0;
-
- ip1 = vlib_buffer_get_current (b1);
- gre_protocol1 = clib_net_to_host_u16 (0x800);
- gre_protocol1 =
- ((ip1->ip_version_and_header_length & 0xF0) == 0x60) ?
- 0x86DD : gre_protocol1;
+ if (PREDICT_FALSE(t->teb))
+ {
+ gre_protocol0 = clib_net_to_host_u16(GRE_PROTOCOL_teb);
+ gre_protocol1 = clib_net_to_host_u16(GRE_PROTOCOL_teb);
+ }
+ else
+ {
+ ip0 = vlib_buffer_get_current (b0);
+ gre_protocol0 = clib_net_to_host_u16 (0x800);
+ gre_protocol0 =
+ ((ip0->ip_version_and_header_length & 0xF0) == 0x60) ?
+ 0x86DD : gre_protocol0;
+
+ ip1 = vlib_buffer_get_current (b1);
+ gre_protocol1 = clib_net_to_host_u16 (0x800);
+ gre_protocol1 =
+ ((ip1->ip_version_and_header_length & 0xF0) == 0x60) ?
+ 0x86DD : gre_protocol1;
+ }
vlib_buffer_advance (b0, -sizeof(*h0));
vlib_buffer_advance (b1, -sizeof(*h1));
@@ -366,10 +374,17 @@ gre_interface_tx (vlib_main_t * vm,
vnet_buffer (b0)->sw_if_index[VLIB_TX] = t->outer_fib_index;
ip0 = vlib_buffer_get_current (b0);
- gre_protocol0 = clib_net_to_host_u16 (0x800);
- gre_protocol0 =
- ((ip0->ip_version_and_header_length & 0xF0) == 0x60) ?
- 0x86DD : gre_protocol0;
+ if (PREDICT_FALSE(t->teb))
+ {
+ gre_protocol0 = clib_net_to_host_u16(GRE_PROTOCOL_teb);
+ }
+ else
+ {
+ gre_protocol0 = clib_net_to_host_u16 (0x800);
+ gre_protocol0 =
+ ((ip0->ip_version_and_header_length & 0xF0) == 0x60) ?
+ 0x86DD : gre_protocol0;
+ }
vlib_buffer_advance (b0, -sizeof(*h0));