diff options
author | Neale Ranns <nranns@cisco.com> | 2020-04-08 12:19:38 +0000 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2020-04-23 08:15:53 +0000 |
commit | 59f71132edffcfa1b94c400736575bd55bdbd7d7 (patch) | |
tree | febcf6fad99ef594d97a3b28806fc3a1a69b8b73 /src/vnet/ip/ip.c | |
parent | c87fbb417a580bf8e93d0176dba6a90b3cd6a787 (diff) |
ip: Replace Sematics for Interface IP addresses
Type: feature
- replace functions for prefixes attached to interfaces
- add ip_interface.[ch] to consoldate the functions
Signed-off-by: Neale Ranns <nranns@cisco.com>
Change-Id: I9c0c39c09dbf80ea1aadefee02c9bd16f094b6ad
Diffstat (limited to 'src/vnet/ip/ip.c')
-rw-r--r-- | src/vnet/ip/ip.c | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/src/vnet/ip/ip.c b/src/vnet/ip/ip.c index 8959b4c09cc..38e53fdef75 100644 --- a/src/vnet/ip/ip.c +++ b/src/vnet/ip/ip.c @@ -96,73 +96,6 @@ ip_set (ip46_address_t * dst, void *src, u8 is_ip4) sizeof (ip6_address_t)); } -u8 -ip_interface_has_address (u32 sw_if_index, ip46_address_t * ip, u8 is_ip4) -{ - ip_interface_address_t *ia = 0; - - if (is_ip4) - { - ip_lookup_main_t *lm4 = &ip4_main.lookup_main; - ip4_address_t *ip4; - /* *INDENT-OFF* */ - foreach_ip_interface_address (lm4, ia, sw_if_index, 1 /* unnumbered */ , - ({ - ip4 = ip_interface_address_get_address (lm4, ia); - if (ip4_address_compare (ip4, &ip->ip4) == 0) - return 1; - })); - /* *INDENT-ON* */ - } - else - { - ip_lookup_main_t *lm6 = &ip6_main.lookup_main; - ip6_address_t *ip6; - /* *INDENT-OFF* */ - foreach_ip_interface_address (lm6, ia, sw_if_index, 1 /* unnumbered */ , - ({ - ip6 = ip_interface_address_get_address (lm6, ia); - if (ip6_address_compare (ip6, &ip->ip6) == 0) - return 1; - })); - /* *INDENT-ON* */ - } - return 0; -} - -void * -ip_interface_get_first_ip (u32 sw_if_index, u8 is_ip4) -{ - ip_lookup_main_t *lm4 = &ip4_main.lookup_main; - ip_lookup_main_t *lm6 = &ip6_main.lookup_main; - ip_interface_address_t *ia = 0; - - if (is_ip4) - { - /* *INDENT-OFF* */ - foreach_ip_interface_address (lm4, ia, sw_if_index, 1 /* unnumbered */ , - ({ - return ip_interface_address_get_address (lm4, ia); - })); - /* *INDENT-ON* */ - } - else - { - /* *INDENT-OFF* */ - foreach_ip_interface_address (lm6, ia, sw_if_index, 1 /* unnumbered */ , - ({ - ip6_address_t *rv; - rv = ip_interface_address_get_address (lm6, ia); - /* Trying to use a link-local ip6 src address is a fool's errand */ - if (!ip6_address_is_link_local_unicast (rv)) - return rv; - })); - /* *INDENT-ON* */ - } - - return 0; -} - u8 * format_ip_address_family (u8 * s, va_list * args) { |