diff options
Diffstat (limited to 'hicn-plugin/src/faces/udp')
-rw-r--r-- | hicn-plugin/src/faces/udp/face_udp_node.c | 6 | ||||
-rw-r--r-- | hicn-plugin/src/faces/udp/iface_udp_node.c | 12 |
2 files changed, 10 insertions, 8 deletions
diff --git a/hicn-plugin/src/faces/udp/face_udp_node.c b/hicn-plugin/src/faces/udp/face_udp_node.c index 184fea679..5d304693d 100644 --- a/hicn-plugin/src/faces/udp/face_udp_node.c +++ b/hicn-plugin/src/faces/udp/face_udp_node.c @@ -137,7 +137,7 @@ typedef enum hicnb0 = hicn_get_buffer(b0); \ \ inner_ip_hdr = (u8 *)(udp_hdr + 1); \ - u8 is_v6 = ((inner_ip_hdr[0] & 2) >> 1); \ + u8 is_v6 = hicn_is_v6((hicn_header_t *)inner_ip_hdr); \ u8 is_icmp = is_v6*(inner_ip_hdr[7] == IPPROTO_ICMPV6) + \ (1 - is_v6)*(inner_ip_hdr[10] == IPPROTO_ICMPV4); \ \ @@ -235,12 +235,12 @@ typedef enum hicnb1 = hicn_get_buffer(b1); \ \ inner_ip_hdr0 = (u8 *)(udp_hdr0 + 1); \ - u8 is_v6_0 = ((inner_ip_hdr0[0] & 2) >> 1); \ + u8 is_v6_0 = hicn_is_v6((hicn_header_t *)inner_ip_hdr0); \ u8 is_icmp0 = is_v6_0*(inner_ip_hdr0[7] == IPPROTO_ICMPV6) + \ (1 - is_v6_0)*(inner_ip_hdr0[10] == IPPROTO_ICMPV4); \ \ inner_ip_hdr1 = (u8 *)(udp_hdr1 + 1); \ - u8 is_v6_1 = ((inner_ip_hdr1[0] & 2) >> 1); \ + u8 is_v6_1 = hicn_is_v6((hicn_header_t *)inner_ip_hdr1); \ u8 is_icmp1 = is_v6_1*(inner_ip_hdr1[7] == IPPROTO_ICMPV6) + \ (1 - is_v6_1)*(inner_ip_hdr1[10] == IPPROTO_ICMPV4); \ \ diff --git a/hicn-plugin/src/faces/udp/iface_udp_node.c b/hicn-plugin/src/faces/udp/iface_udp_node.c index 4dc267f85..738aad829 100644 --- a/hicn-plugin/src/faces/udp/iface_udp_node.c +++ b/hicn-plugin/src/faces/udp/iface_udp_node.c @@ -39,11 +39,13 @@ hicn_iface_udp_init (vlib_main_t * vm) { data_fwd_face_udp4_vlib_edge = vlib_node_add_next (vm, hicn_data_fwd_node.index, - hicn_iface_udp4_output_node.index); + hicn_iface_udp4_output_node. + index); data_fwd_face_udp6_vlib_edge = vlib_node_add_next (vm, hicn_data_fwd_node.index, - hicn_iface_udp6_output_node.index); + hicn_iface_udp6_output_node. + index); u32 temp_index4 = vlib_node_add_next (vm, hicn_interest_hitcs_node.index, @@ -170,7 +172,7 @@ typedef enum stats.pkts_interest_count += 1; \ \ inner_ip_hdr = (u8 *)(udp_hdr + 1); \ - u8 is_v6 = ((inner_ip_hdr[0] & 2) >> 1); \ + u8 is_v6 = hicn_is_v6((hicn_header_t *)inner_ip_hdr); \ u8 is_icmp = is_v6*(inner_ip_hdr[7] == IPPROTO_ICMPV6) + \ (1 - is_v6)*(inner_ip_hdr[10] == IPPROTO_ICMPV4); \ \ @@ -263,8 +265,8 @@ typedef enum \ inner_ip_hdr0 = (u8 *)(udp_hdr0 + 1); \ inner_ip_hdr1 = (u8 *)(udp_hdr1 + 1); \ - u8 is_v6_0 = ((inner_ip_hdr0[0] & 2) >> 1); \ - u8 is_v6_1 = ((inner_ip_hdr1[0] & 2) >> 1); \ + u8 is_v6_0 = hicn_is_v6((hicn_header_t *)inner_ip_hdr0); \ + u8 is_v6_1 = hicn_is_v6((hicn_header_t *)inner_ip_hdr1); \ u8 is_icmp0 = is_v6_0*(inner_ip_hdr0[7] == IPPROTO_ICMPV6) + \ (1 - is_v6_0)*(inner_ip_hdr0[10] == IPPROTO_ICMPV4); \ u8 is_icmp1 = is_v6_1*(inner_ip_hdr1[7] == IPPROTO_ICMPV6) + \ |