diff options
author | Neale Ranns <nranns@cisco.com> | 2016-11-22 17:07:28 +0000 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2017-01-27 19:53:46 +0000 |
commit | 32e1c010b0c34fd0984f7fc45fae648a182025c5 (patch) | |
tree | 06a440bdc9dc039ad0dcf866acc9e10a6ea5e2e7 /src/vnet/rewrite.h | |
parent | 6f692d6e5a8ffc920a728372ef773199bc5466c0 (diff) |
IP Multicast FIB (mfib)
- IPv[46] mfib tables with support for (*,G/m), (*,G) and (S,G) exact and longest prefix match
- Replication represented via a new replicate DPO.
- RPF configuration and data-plane checking
- data-plane signals sent to listening control planes.
The functions of multicast forwarding entries differ from their unicast conterparts, so we introduce a new mfib_table_t and mfib_entry_t objects. However, we re-use the fib_path_list to resolve and build the entry's output list. the fib_path_list provides the service to construct a replicate DPO for multicast.
'make tests' is added to with two new suites; TEST=mfib, this is invocation of the CLI command 'test mfib' which deals with many path add/remove, flag set/unset scenarios, TEST=ip-mcast, data-plane forwarding tests.
Updated applications to use the new MIFB functions;
- IPv6 NS/RA.
- DHCPv6
unit tests for these are undated accordingly.
Change-Id: I49ec37b01f1b170335a5697541c8fd30e6d3a961
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/rewrite.h')
-rw-r--r-- | src/vnet/rewrite.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/vnet/rewrite.h b/src/vnet/rewrite.h index 00c1efbdc5e..ce2bce3a3c8 100644 --- a/src/vnet/rewrite.h +++ b/src/vnet/rewrite.h @@ -64,6 +64,16 @@ typedef CLIB_PACKED (struct { Used for MTU check after packet rewrite. */ u16 max_l3_packet_bytes; + /* When dynamically writing a multicast destination L2 addresss + * this is the offset within the address to start writing n + * bytes of the IP mcast address */ + u8 dst_mcast_offset; + + /* When dynamically writing a multicast destination L2 addresss + * this is the number of bytes of the dest IP address to write into + * the MAC rewrite */ + u8 dst_mcast_n_bytes; + /* Rewrite string starting at end and going backwards. */ u8 data[0]; }) vnet_rewrite_header_t; @@ -261,6 +271,27 @@ _vnet_rewrite_two_headers (vnet_rewrite_header_t * h0, sizeof ((rw0).rewrite_data), \ (most_likely_size)) +always_inline void +_vnet_fixup_one_header (vnet_rewrite_header_t * h0, + u8 * addr, u32 addr_len, + u8 * packet0, int clear_first_bit) +{ + /* location to write to in the packet */ + u8 *p0 = packet0 - h0->dst_mcast_offset; + u8 *p1 = p0; + /* location to write from in the L3 dest address */ + u8 *a0 = addr + addr_len - h0->dst_mcast_n_bytes; + + clib_memcpy (p0, a0, h0->dst_mcast_n_bytes); + if (clear_first_bit) + *p1 &= 0x7f; +} + +#define vnet_fixup_one_header(rw0,addr,p0,clear_first_bit) \ + _vnet_fixup_one_header (&((rw0).rewrite_header), \ + (u8*)(addr), sizeof((*addr)), \ + (u8*)(p0), (clear_first_bit)) + #define VNET_REWRITE_FOR_SW_INTERFACE_ADDRESS_BROADCAST ((void *) 0) /** Deprecated */ void vnet_rewrite_for_sw_interface (struct vnet_main_t *vnm, |