2 * Copyright (c) 2015-2019 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #include <vnet/ip/ip46_address.h>
19 format_ip46_type (u8 * s, va_list * args)
21 ip46_type_t type = va_arg (*args, ip46_type_t);
26 return (format (s, "ip4"));
28 return (format (s, "ip6"));
30 return (format (s, "any"));
33 return (format (s, "unknown"));
37 ip4_address_increment (ip4_address_t * i)
39 u32 t = clib_net_to_host_u32 (i->as_u32);
41 i->as_u32 = clib_net_to_host_u32 (t);
45 ip6_address_increment (ip6_address_t * i)
47 u64 tmp = clib_net_to_host_u64 (i->as_u64[1]);
50 i->as_u64[1] = clib_host_to_net_u64 (tmp);
54 tmp = clib_net_to_host_u64 (i->as_u64[0]);
56 i->as_u64[0] = clib_host_to_net_u64 (tmp);
61 ip46_address_increment (ip46_type_t type, ip46_address_t * ip)
63 if (IP46_TYPE_IP4 == type ||
64 (IP46_TYPE_ANY == type && ip46_address_is_ip4 (ip)))
65 ip4_address_increment (&ip->ip4);
67 ip6_address_increment (&ip->ip6);
71 * fd.io coding-style-patch-verification: ON
74 * eval: (c-set-style "gnu")