summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip.c
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2021-10-25 09:47:09 +0000
committerNeale Ranns <neale@graphiant.com>2021-11-18 14:06:02 +0000
commitb28652ed7ab016177593b059390f2e99e6af2961 (patch)
tree99f1bc49227d37e467cb74216de8e9324436b416 /src/vnet/ip/ip.c
parentfc8d0c510372823ac029b6330e876fab9400dbae (diff)
ip: comparing IP prefixes should not modify them
Type: improvement make the ip_prefix_cmp take const paramenters. plus some other miscellaneous functions. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: Ib69bacfb09483a8a8f8b89900c92d3d55c354ac6
Diffstat (limited to 'src/vnet/ip/ip.c')
-rw-r--r--src/vnet/ip/ip.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/vnet/ip/ip.c b/src/vnet/ip/ip.c
index 5d0c7707dd3..0a602b43ac7 100644
--- a/src/vnet/ip/ip.c
+++ b/src/vnet/ip/ip.c
@@ -18,6 +18,20 @@
u32 ip_flow_hash_router_id;
+ethernet_type_t
+ip_address_family_to_ether_type (ip_address_family_t af)
+{
+ switch (af)
+ {
+ case AF_IP4:
+ return (ETHERNET_TYPE_IP4);
+ case AF_IP6:
+ return (ETHERNET_TYPE_IP6);
+ }
+ ASSERT (0);
+ return (ETHERNET_TYPE_IP4);
+}
+
u8
ip_is_zero (ip46_address_t * ip46_address, u8 is_ip4)
{