diff options
author | Neale Ranns <neale.ranns@cisco.com> | 2018-04-04 09:34:50 -0700 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2018-04-13 08:51:21 +0000 |
commit | 25b049484fcf9161edb2c19250066b893c38c264 (patch) | |
tree | 69204352a0648cfc4089fa0e37214bffbae61e81 /src/vnet | |
parent | 4f8863b21405d1ab3e067e978a60be72a343358b (diff) |
GBP V2
update the GBP plugin to implement the full NAT feature set of opflex agent
Change-Id: Ic06a039c889445ed0b9087fa1f292634192b0f8d
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/buffer.h | 8 | ||||
-rw-r--r-- | src/vnet/ethernet/arp.c | 15 | ||||
-rw-r--r-- | src/vnet/ethernet/arp_packet.h | 5 | ||||
-rw-r--r-- | src/vnet/fib/fib_table.c | 11 | ||||
-rw-r--r-- | src/vnet/fib/fib_table.h | 15 | ||||
-rw-r--r-- | src/vnet/ip/ip6.h | 5 | ||||
-rw-r--r-- | src/vnet/ip/ip6_neighbor.c | 14 | ||||
-rw-r--r-- | src/vnet/l2/l2_input.c | 3 | ||||
-rw-r--r-- | src/vnet/l2/l2_input.h | 3 | ||||
-rw-r--r-- | src/vnet/l2/l2_output.h | 1 |
10 files changed, 73 insertions, 7 deletions
diff --git a/src/vnet/buffer.h b/src/vnet/buffer.h index 02688e26530..86f75389d70 100644 --- a/src/vnet/buffer.h +++ b/src/vnet/buffer.h @@ -387,6 +387,12 @@ typedef struct u8 __unused[2]; + /* Group Based Policy */ + struct + { + u32 src_epg; + } gbp; + union { struct @@ -396,7 +402,7 @@ typedef struct u16 *trajectory_trace; #endif }; - u32 unused[11]; + u32 unused[10]; }; } vnet_buffer_opaque2_t; diff --git a/src/vnet/ethernet/arp.c b/src/vnet/ethernet/arp.c index 925fb2cc6ac..9114d7a90f3 100644 --- a/src/vnet/ethernet/arp.c +++ b/src/vnet/ethernet/arp.c @@ -2498,11 +2498,22 @@ ethernet_arp_change_mac (u32 sw_if_index) } void -send_ip4_garp (vlib_main_t * vm, vnet_hw_interface_t * hi) +send_ip4_garp (vlib_main_t * vm, const vnet_hw_interface_t * hi) +{ + ip4_main_t *i4m = &ip4_main; + ip4_address_t *ip4_addr = + ip4_interface_first_address (i4m, hi->sw_if_index, 0); + + send_ip4_garp_w_addr (vm, ip4_addr, hi); +} + +void +send_ip4_garp_w_addr (vlib_main_t * vm, + const ip4_address_t * ip4_addr, + const vnet_hw_interface_t * hi) { ip4_main_t *i4m = &ip4_main; u32 sw_if_index = hi->sw_if_index; - ip4_address_t *ip4_addr = ip4_interface_first_address (i4m, sw_if_index, 0); if (ip4_addr) { diff --git a/src/vnet/ethernet/arp_packet.h b/src/vnet/ethernet/arp_packet.h index 661f33f93af..4b7b0482fb7 100644 --- a/src/vnet/ethernet/arp_packet.h +++ b/src/vnet/ethernet/arp_packet.h @@ -167,7 +167,10 @@ typedef struct ethernet_arp_ip4_entry_t *ip4_neighbor_entries (u32 sw_if_index); u8 *format_ethernet_arp_ip4_entry (u8 * s, va_list * va); -void send_ip4_garp (vlib_main_t * vm, vnet_hw_interface_t * hi); +void send_ip4_garp (vlib_main_t * vm, const vnet_hw_interface_t * hi); +void send_ip4_garp_w_addr (vlib_main_t * vm, + const ip4_address_t * ip4_addr, + const vnet_hw_interface_t * hi); #endif /* included_ethernet_arp_packet_h */ diff --git a/src/vnet/fib/fib_table.c b/src/vnet/fib/fib_table.c index 324a35fe1e8..d0bc33639b9 100644 --- a/src/vnet/fib/fib_table.c +++ b/src/vnet/fib/fib_table.c @@ -1034,6 +1034,17 @@ fib_table_get_table_id_for_sw_if_index (fib_protocol_t proto, } u32 +fib_table_get_table_id (u32 fib_index, + fib_protocol_t proto) +{ + fib_table_t *fib_table; + + fib_table = fib_table_get(fib_index, proto); + + return ((NULL != fib_table ? fib_table->ft_table_id : ~0)); +} + +u32 fib_table_find (fib_protocol_t proto, u32 table_id) { diff --git a/src/vnet/fib/fib_table.h b/src/vnet/fib/fib_table.h index ffad3c43d3e..8b86f8d6dd9 100644 --- a/src/vnet/fib/fib_table.h +++ b/src/vnet/fib/fib_table.h @@ -645,6 +645,21 @@ extern u32 fib_table_get_table_id_for_sw_if_index(fib_protocol_t proto, /** * @brief + * Get the Table-ID of the FIB from protocol and index + * + * @param fib_index + * The FIB index + * + * @paran proto + * The protocol of the FIB (and thus the entries therein) + * + * @return fib_index + * The tableID of the FIB + */ +extern u32 fib_table_get_table_id(u32 fib_index, fib_protocol_t proto); + +/** + * @brief * Get the index of the FIB for a Table-ID. This DOES NOT create the * FIB if it does not exist. * diff --git a/src/vnet/ip/ip6.h b/src/vnet/ip/ip6.h index 959d72c0fad..359c461d1e0 100644 --- a/src/vnet/ip/ip6.h +++ b/src/vnet/ip/ip6.h @@ -404,7 +404,10 @@ int vnet_ip6_nd_term (vlib_main_t * vm, ethernet_header_t * eth, ip6_header_t * ip, u32 sw_if_index, u16 bd_index); -void send_ip6_na (vlib_main_t * vm, vnet_hw_interface_t * hi); +void send_ip6_na (vlib_main_t * vm, const vnet_hw_interface_t * hi); +void send_ip6_na_w_addr (vlib_main_t * vm, + const ip6_address_t * addr, + const vnet_hw_interface_t * hi); u8 *format_ip6_forward_next_trace (u8 * s, va_list * args); diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c index 0df29c6bc02..fee4356f5e0 100644 --- a/src/vnet/ip/ip6_neighbor.c +++ b/src/vnet/ip/ip6_neighbor.c @@ -4670,11 +4670,23 @@ ethernet_ndp_change_mac (u32 sw_if_index) } void -send_ip6_na (vlib_main_t * vm, vnet_hw_interface_t * hi) +send_ip6_na (vlib_main_t * vm, const vnet_hw_interface_t * hi) { ip6_main_t *i6m = &ip6_main; u32 sw_if_index = hi->sw_if_index; ip6_address_t *ip6_addr = ip6_interface_first_address (i6m, sw_if_index); + + send_ip6_na_w_addr (vm, ip6_addr, hi); +} + +void +send_ip6_na_w_addr (vlib_main_t * vm, + const ip6_address_t * ip6_addr, + const vnet_hw_interface_t * hi) +{ + ip6_main_t *i6m = &ip6_main; + u32 sw_if_index = hi->sw_if_index; + if (ip6_addr) { clib_warning diff --git a/src/vnet/l2/l2_input.c b/src/vnet/l2/l2_input.c index d8a0a6bd798..69de2815536 100644 --- a/src/vnet/l2/l2_input.c +++ b/src/vnet/l2/l2_input.c @@ -176,7 +176,8 @@ classify_and_dispatch (l2input_main_t * msm, vlib_buffer_t * b0, u32 * next0) u8 protocol = ((ip6_header_t *) l3h0)->protocol; /* Disable bridge forwarding (flooding will execute instead if not xconnect) */ - feat_mask &= ~(L2INPUT_FEAT_FWD | L2INPUT_FEAT_UU_FLOOD); + feat_mask &= ~(L2INPUT_FEAT_FWD | + L2INPUT_FEAT_UU_FLOOD | L2INPUT_FEAT_GBP_FWD); /* Disable ARP-term for non-ARP and non-ICMP6 packet */ if (ethertype != ETHERNET_TYPE_ARP && diff --git a/src/vnet/l2/l2_input.h b/src/vnet/l2/l2_input.h index dc9d95484ee..5d67f257e46 100644 --- a/src/vnet/l2/l2_input.h +++ b/src/vnet/l2/l2_input.h @@ -109,10 +109,13 @@ l2input_bd_config (u32 bd_index) _(FLOOD, "l2-flood") \ _(ARP_TERM, "arp-term-l2bd") \ _(UU_FLOOD, "l2-flood") \ + _(GBP_FWD, "gbp-fwd") \ _(FWD, "l2-fwd") \ _(RW, "l2-rw") \ _(LEARN, "l2-learn") \ _(L2_EMULATION, "l2-emulation") \ + _(GBP_NULL_CLASSIFY, "gbp-null-classify") \ + _(GBP_SRC_CLASSIFY, "gbp-src-classify") \ _(VTR, "l2-input-vtr") \ _(VPATH, "vpath-input-l2") \ _(ACL, "l2-input-acl") \ diff --git a/src/vnet/l2/l2_output.h b/src/vnet/l2/l2_output.h index 3b6e480d1dc..6b00d01655c 100644 --- a/src/vnet/l2/l2_output.h +++ b/src/vnet/l2/l2_output.h @@ -85,6 +85,7 @@ extern vlib_node_registration_t l2output_node; #define foreach_l2output_feat \ _(OUTPUT, "interface-output") \ _(SPAN, "span-l2-output") \ + _(GBP_POLICY, "gbp-policy") \ _(CFM, "feature-bitmap-drop") \ _(QOS, "feature-bitmap-drop") \ _(ACL, "l2-output-acl") \ |