40 #ifndef included_ip6_packet_h 41 #define included_ip6_packet_h 69 #define ip46_address_is_ip4(ip46) (((ip46)->pad[0] | (ip46)->pad[1] | (ip46)->pad[2]) == 0) 70 #define ip46_address_mask_ip4(ip46) ((ip46)->pad[0] = (ip46)->pad[1] = (ip46)->pad[2] = 0) 71 #define ip46_address_set_ip4(ip46, ip) (ip46_address_mask_ip4(ip46), (ip46)->ip4 = (ip)[0]) 72 #define ip46_address_reset(ip46) ((ip46)->as_u64[0] = (ip46)->as_u64[1] = 0) 78 addr_fib->ip6_addr.as_u64[0] = address->
as_u64[0];
79 addr_fib->ip6_addr.as_u64[1] = address->
as_u64[1];
80 addr_fib->fib_index = fib_index;
92 #define foreach_ip6_multicast_address_scope \ 95 _ (admin_local, 0x4) \ 97 _ (organization_local, 0x8) \ 100 #define foreach_ip6_multicast_link_local_group_id \ 102 _ (all_routers, 0x2) \ 103 _ (rip_routers, 0x9) \ 104 _ (eigrp_routers, 0xa) \ 105 _ (pim_routers, 0xd) \ 106 _ (mldv2_routers, 0x16) 109 #define _(f,n) IP6_MULTICAST_SCOPE_##f = n, 115 #define _(f,n) IP6_MULTICAST_GROUP_ID_##f = n, 122 {
return a->
as_u8[0] == 0xff; }
126 ip6_multicast_address_scope_t scope,
130 a->
as_u16[0] = clib_host_to_net_u16 (0xff00 | scope);
131 a->
as_u16[7] = clib_host_to_net_u16 (
id);
139 a->
as_u16[0] = clib_host_to_net_u16 (0xff02);
143 a->
as_u32[3] = clib_host_to_net_u32 (
id);
150 a->
as_u16[0] = clib_host_to_net_u16 (0xfe80);
152 a->
as_u8[0x8] = ethernet_address[0] | (1 << 6);
153 a->
as_u8[0x9] = ethernet_address[1];
154 a->
as_u8[0xa] = ethernet_address[2];
155 a->
as_u8[0xb] = 0xff;
156 a->
as_u8[0xc] = 0xfe;
157 a->
as_u8[0xd] = ethernet_address[3];
158 a->
as_u8[0xe] = ethernet_address[4];
159 a->
as_u8[0xf] = ethernet_address[5];
165 ethernet_address[0] = 0x33;
166 ethernet_address[1] = 0x33;
167 ethernet_address[2] = ((group_id >> 24) & 0xff);
168 ethernet_address[3] = ((group_id >> 16) & 0xff);
169 ethernet_address[4] = ((group_id >> 8) & 0xff);
170 ethernet_address[5] = ((group_id >> 0) & 0xff);
190 uword a_masked, b_masked;
194 if (a_masked != b_masked)
219 int i, byte, bit, bitnum;
221 memset (a, 0,
sizeof (a[0]));
222 for (i = 0; i < width; i++)
224 bitnum = (7 - (i & 7));
227 a->
as_u8[byte] |= bit;
252 a->
as_u8[15] = save ^ 1;
261 {
return a->
as_u8[0] == 0xfe && (a->
as_u8[1] & 0xc0) == 0x80; }
266 {
return (a->
as_u8[0] & 0xfe) == 0xfc; }
272 return (a->
as_u32[0] == clib_host_to_net_u32 (0xff020000)
274 && a->
as_u32[2] == clib_host_to_net_u32 (1)
275 && a->
as_u8[12] == 0xff);
298 {
return (
void *) (i + 1); }
340 u16 src0, dst0, src1, dst1;
356 }) ip6_pad1_option_t;
362 }) ip6_padN_option_t;
365 #define IP6_MLDP_ALERT_TYPE 0x5 369 }) ip6_router_alert_option_t;
376 }) ip6_hop_by_hop_ext_t;
381 u16 fragment_offset_and_more;
385 #define ip6_frag_hdr_offset(hdr) \ 386 (clib_net_to_host_u16((hdr)->fragment_offset_and_more) >> 3) 388 #define ip6_frag_hdr_more(hdr) \ 389 (clib_net_to_host_u16((hdr)->fragment_offset_and_more) & 0x1) 391 #define ip6_frag_hdr_offset_and_more(offset, more) \ 392 clib_host_to_net_u16(((offset) << 3) + !!(more)) always_inline void ip6_multicast_ethernet_address(u8 *ethernet_address, u32 group_id)
#define foreach_ip6_multicast_link_local_group_id
always_inline void ip6_address_mask_from_width(ip6_address_t *a, u32 width)
sll srl srl sll sra u16x4 i
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
ip6_multicast_address_scope_t
always_inline uword ip6_address_is_unspecified(ip6_address_t *a)
always_inline void ip6_tcp_reply_x1(ip6_header_t *ip0, tcp_header_t *tcp0)
always_inline void ip6_set_reserved_multicast_address(ip6_address_t *a, ip6_multicast_address_scope_t scope, u16 id)
always_inline uword ip6_address_is_link_local_unicast(ip6_address_t *a)
always_inline uword ip6_address_is_multicast(ip6_address_t *a)
always_inline void * ip6_next_header(ip6_header_t *i)
uword as_uword[16/sizeof(uword)]
typedef CLIB_PACKED(struct{ip6_address_t ip6_addr;u32 fib_index;}) ip6_address_fib_t
always_inline uword ip6_address_is_zero(ip6_address_t *a)
always_inline uword ip6_address_is_equal_masked(ip6_address_t *a, ip6_address_t *b, ip6_address_t *mask)
#define foreach_ip6_multicast_address_scope
always_inline uword ip6_address_is_loopback(ip6_address_t *a)
always_inline void ip6_tcp_reply_x2(ip6_header_t *ip0, ip6_header_t *ip1, tcp_header_t *tcp0, tcp_header_t *tcp1)
always_inline uword ip6_address_is_equal(ip6_address_t *a, ip6_address_t *b)
always_inline void ip6_address_set_zero(ip6_address_t *a)
always_inline void ip6_link_local_address_from_ethernet_address(ip6_address_t *a, u8 *ethernet_address)
always_inline void ip6_set_solicited_node_multicast_address(ip6_address_t *a, u32 id)
always_inline uword ip6_is_solicited_node_multicast_address(ip6_address_t *a)
ip6_multicast_link_local_group_id_t
always_inline void ip6_addr_fib_init(ip6_address_fib_t *addr_fib, ip6_address_t *address, u32 fib_index)
always_inline void ip6_address_mask(ip6_address_t *a, ip6_address_t *mask)
always_inline uword ip6_address_is_local_unicast(ip6_address_t *a)