dhcp ip: DSCP settings for transmitted DHCP packets
[vpp.git] / src / vnet / ip / ip6_packet.h
index ff47830..c1bd2aa 100644 (file)
@@ -75,7 +75,7 @@ typedef enum
 } ip46_type_t;
 
 /* *INDENT-OFF* */
-typedef CLIB_PACKED (union {
+typedef CLIB_PACKED (union ip46_address_t_ {
   struct {
     u32 pad[3];
     ip4_address_t ip4;
@@ -95,6 +95,21 @@ typedef CLIB_PACKED (union {
                                          && ((a1)->as_u64[1] == (a2)->as_u64[1]))
 #define ip46_address_initializer {{{ 0 }}}
 
+static_always_inline int
+ip46_address_is_equal_v4 (const ip46_address_t * ip46,
+                         const ip4_address_t * ip4)
+{
+  return (ip46->ip4.as_u32 == ip4->as_u32);
+}
+
+static_always_inline int
+ip46_address_is_equal_v6 (const ip46_address_t * ip46,
+                         const ip6_address_t * ip6)
+{
+  return ((ip46->ip6.as_u64[0] == ip6->as_u64[0]) &&
+         (ip46->ip6.as_u64[1] == ip6->as_u64[1]));
+}
+
 static_always_inline void
 ip46_address_copy (ip46_address_t * dst, const ip46_address_t * src)
 {
@@ -368,13 +383,13 @@ typedef struct
   ip6_address_t src_address, dst_address;
 } ip6_header_t;
 
-always_inline u8
+always_inline ip_dscp_t
 ip6_traffic_class (const ip6_header_t * i)
 {
   return (i->ip_version_traffic_class_and_flow_label & 0x0FF00000) >> 20;
 }
 
-static_always_inline u8
+static_always_inline ip_dscp_t
 ip6_traffic_class_network_order (const ip6_header_t * ip6)
 {
   return (clib_net_to_host_u32 (ip6->ip_version_traffic_class_and_flow_label)
@@ -382,7 +397,7 @@ ip6_traffic_class_network_order (const ip6_header_t * ip6)
 }
 
 static_always_inline void
-ip6_set_traffic_class_network_order (ip6_header_t * ip6, u8 dscp)
+ip6_set_traffic_class_network_order (ip6_header_t * ip6, ip_dscp_t dscp)
 {
   u32 tmp =
     clib_net_to_host_u32 (ip6->ip_version_traffic_class_and_flow_label);