From b28652ed7ab016177593b059390f2e99e6af2961 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Mon, 25 Oct 2021 09:47:09 +0000 Subject: 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 Change-Id: Ib69bacfb09483a8a8f8b89900c92d3d55c354ac6 --- src/vnet/ip/ip.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/vnet/ip/ip.c') 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) { -- cgit 1.2.3-korg