]> git.puffer.fish Git - matthieu/frr.git/commitdiff
*: use an ifindex_t type, defined in lib/if.h, for ifindex values
authorPaul Jakma <paul.jakma@hpe.com>
Mon, 18 Jan 2016 10:12:10 +0000 (10:12 +0000)
committerDonald Sharp <sharpd@cumulusnetwroks.com>
Thu, 18 Aug 2016 11:35:38 +0000 (07:35 -0400)
(cherry picked from commit 9099f9b2a66e86f8a90d7fe18f61bd2bb1bc6744)

69 files changed:
bgpd/bgp_attr.h
bgpd/bgp_btoa.c
bgpd/bgp_network.c
bgpd/bgp_zebra.c
bgpd/bgp_zebra.h
bgpd/bgpd.h
isisd/isis_route.c
isisd/isis_route.h
isisd/isis_zebra.c
lib/if.c
lib/if.h
lib/nexthop.h
lib/sockopt.c
lib/sockopt.h
lib/sockunion.c
lib/sockunion.h
lib/zclient.c
lib/zclient.h
ospf6d/ospf6_asbr.c
ospf6d/ospf6_asbr.h
ospf6d/ospf6_interface.c
ospf6d/ospf6_interface.h
ospf6d/ospf6_message.c
ospf6d/ospf6_message.h
ospf6d/ospf6_neighbor.h
ospf6d/ospf6_network.c
ospf6d/ospf6_network.h
ospf6d/ospf6_route.c
ospf6d/ospf6_route.h
ospf6d/ospf6_snmp.c
ospf6d/ospf6_spf.c
ospf6d/ospf6_zebra.c
ospfd/ospf_asbr.c
ospfd/ospf_asbr.h
ospfd/ospf_lsa.c
ospfd/ospf_lsa.h
ospfd/ospf_network.c
ospfd/ospf_network.h
ospfd/ospf_packet.c
ospfd/ospf_route.h
ospfd/ospf_snmp.c
pimd/pim_iface.c
pimd/pim_iface.h
pimd/pim_igmp.c
pimd/pim_igmp_join.h
pimd/pim_pim.c
pimd/pim_sock.c
pimd/pim_sock.h
pimd/pim_ssmpingd.c
pimd/pim_static.c
pimd/pim_static.h
pimd/pim_zebra.c
pimd/pim_zlookup.h
pimd/test_igmpv3_join.c
ripd/rip_interface.c
ripd/ripd.c
ripd/ripd.h
ripngd/ripng_zebra.c
ripngd/ripngd.c
ripngd/ripngd.h
zebra/kernel_socket.c
zebra/rib.h
zebra/rt_netlink.c
zebra/rt_socket.c
zebra/rtadv.c
zebra/test_main.c
zebra/zebra_rib.c
zebra/zebra_routemap.c
zebra/zserv.c

index a279674af280f97884eea2e1f7e7b342787f7063..b8cdfea137447c7e4837a664a27224476504fba2 100644 (file)
@@ -131,7 +131,7 @@ struct attr
   struct in_addr nexthop;
   u_int32_t med;
   u_int32_t local_pref;
-  u_int32_t nh_ifindex;
+  ifindex_t nh_ifindex;
   
   /* Path origin attribute */
   u_char origin;
index 904ae66e109a5c6ee4ad0a910f7b5aeec8deac17..cd52c94b1fc534b8f432a573e097f36eb8ae358d 100644 (file)
@@ -144,7 +144,7 @@ main (int argc, char **argv)
   size_t len;
   int source_as;
   int dest_as;
-  int ifindex;
+  ifindex_t ifindex;
   int family;
   struct in_addr sip;
   struct in_addr dip;
index 0caada488b1554f92f5e1682d96bb8ac5ad05a04..ed1c5600ee69bb6460a73a957e507f13c8b3021a 100644 (file)
@@ -579,7 +579,7 @@ bgp_update_source (struct peer *peer)
 int
 bgp_connect (struct peer *peer)
 {
-  unsigned int ifindex = 0;
+  ifindex_t ifindex = 0;
 
   if (peer->conf_if && BGP_PEER_SU_UNSPEC(peer))
     {
index ce5d1b498ed9e81485b388e24a7de8be3ac3e30e..81bede0e927d49a8412ac8915604557b646634de 100644 (file)
@@ -856,7 +856,7 @@ if_lookup_by_ipv4_exact (struct in_addr *addr, vrf_id_t vrf_id)
 
 #ifdef HAVE_IPV6
 struct interface *
-if_lookup_by_ipv6 (struct in6_addr *addr, unsigned int ifindex, vrf_id_t vrf_id)
+if_lookup_by_ipv6 (struct in6_addr *addr, ifindex_t ifindex, vrf_id_t vrf_id)
 {
   struct listnode *ifnode;
   struct listnode *cnode;
@@ -892,7 +892,7 @@ if_lookup_by_ipv6 (struct in6_addr *addr, unsigned int ifindex, vrf_id_t vrf_id)
 }
 
 struct interface *
-if_lookup_by_ipv6_exact (struct in6_addr *addr, unsigned int ifindex, vrf_id_t vrf_id)
+if_lookup_by_ipv6_exact (struct in6_addr *addr, ifindex_t ifindex, vrf_id_t vrf_id)
 {
   struct listnode *ifnode;
   struct listnode *cnode;
@@ -1381,7 +1381,7 @@ bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp,
   if (p->family == AF_INET6 ||
       (p->family == AF_INET && BGP_ATTR_NEXTHOP_AFI_IP6(info->attr)))
     {
-      unsigned int ifindex;
+      ifindex_t ifindex;
       struct in6_addr *nexthop;
       struct zapi_ipv6 api;
       int valid_nh_count = 0;
@@ -1527,7 +1527,7 @@ bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp,
       api.nexthop = (struct in6_addr **)STREAM_DATA (bgp_nexthop_buf);
       SET_FLAG (api.message, ZAPI_MESSAGE_IFINDEX);
       api.ifindex_num = valid_nh_count;
-      api.ifindex = (unsigned int *)STREAM_DATA (bgp_ifindices_buf);
+      api.ifindex = (ifindex_t *)STREAM_DATA (bgp_ifindices_buf);
       SET_FLAG (api.message, ZAPI_MESSAGE_METRIC);
       api.metric = metric;
       api.tag = 0;
index 1f845bd9184c512eb9bba54fcb32a001e26e4c8c..af921af82f35c54dbf95af9b2c3d34ed60e3d207 100644 (file)
@@ -58,8 +58,8 @@ extern int bgp_redistribute_unreg (struct bgp *, afi_t, int, u_short);
 extern struct interface *if_lookup_by_ipv4 (struct in_addr *, vrf_id_t);
 extern struct interface *if_lookup_by_ipv4_exact (struct in_addr *, vrf_id_t);
 #ifdef HAVE_IPV6
-extern struct interface *if_lookup_by_ipv6 (struct in6_addr *, unsigned int, vrf_id_t);
-extern struct interface *if_lookup_by_ipv6_exact (struct in6_addr *, unsigned int, vrf_id_t);
+extern struct interface *if_lookup_by_ipv6 (struct in6_addr *, ifindex_t, vrf_id_t);
+extern struct interface *if_lookup_by_ipv6_exact (struct in6_addr *, ifindex_t, vrf_id_t);
 #endif /* HAVE_IPV6 */
 
 #endif /* _QUAGGA_BGP_ZEBRA_H */
index 991afdf7ccc91fa3c04934aa5500da15014c5dea..d9a68599c53ccfc910c882e63b7905edc6811e86 100644 (file)
@@ -583,7 +583,7 @@ struct peer
   time_t readtime;             /* Last read time */
   time_t resettime;            /* Last reset time */
   
-  unsigned int ifindex;                /* ifindex of the BGP connection. */
+  ifindex_t ifindex;           /* ifindex of the BGP connection. */
   char *conf_if;                /* neighbor interface config name. */
   struct interface *ifp;        /* corresponding interface */
   char *ifname;                        /* bind interface name. */
index e72e0cac7afd03aacfca6b416f6bd0f9aa182dff..67d45c8f10d8b6819cf3189e451ea8aa4f44e1d7 100644 (file)
@@ -50,7 +50,7 @@
 #include "isis_zebra.h"
 
 static struct isis_nexthop *
-isis_nexthop_create (struct in_addr *ip, unsigned int ifindex)
+isis_nexthop_create (struct in_addr *ip, ifindex_t ifindex)
 {
   struct listnode *node;
   struct isis_nexthop *nexthop;
@@ -91,7 +91,7 @@ isis_nexthop_delete (struct isis_nexthop *nexthop)
 
 static int
 nexthoplookup (struct list *nexthops, struct in_addr *ip,
-              unsigned int ifindex)
+              ifindex_t ifindex)
 {
   struct listnode *node;
   struct isis_nexthop *nh;
@@ -130,7 +130,7 @@ nexthops_print (struct list *nhs)
 
 #ifdef HAVE_IPV6
 static struct isis_nexthop6 *
-isis_nexthop6_new (struct in6_addr *ip6, unsigned int ifindex)
+isis_nexthop6_new (struct in6_addr *ip6, ifindex_t ifindex)
 {
   struct isis_nexthop6 *nexthop6;
 
@@ -144,7 +144,7 @@ isis_nexthop6_new (struct in6_addr *ip6, unsigned int ifindex)
 }
 
 static struct isis_nexthop6 *
-isis_nexthop6_create (struct in6_addr *ip6, unsigned int ifindex)
+isis_nexthop6_create (struct in6_addr *ip6, ifindex_t ifindex)
 {
   struct listnode *node;
   struct isis_nexthop6 *nexthop6;
@@ -181,7 +181,7 @@ isis_nexthop6_delete (struct isis_nexthop6 *nexthop6)
 
 static int
 nexthop6lookup (struct list *nexthops6, struct in6_addr *ip6,
-               unsigned int ifindex)
+               ifindex_t ifindex)
 {
   struct listnode *node;
   struct isis_nexthop6 *nh6;
index 5adea2293b2edf907d19297f2c513e2babd9a9e2..0d2379cbe8b90568e0d4cbc4bc041115a3059dc8 100644 (file)
@@ -28,7 +28,7 @@
 #ifdef HAVE_IPV6
 struct isis_nexthop6
 {
-  unsigned int ifindex;
+  ifindex_t ifindex;
   struct in6_addr ip6;
   struct in6_addr router_address6;
   unsigned int lock;
@@ -37,7 +37,7 @@ struct isis_nexthop6
 
 struct isis_nexthop
 {
-  unsigned int ifindex;
+  ifindex_t ifindex;
   struct in_addr ip;
   struct in_addr router_address;
   unsigned int lock;
index 125a2f63d3ed1a853d74bcde5bcf047e97da2e2d..81f9d869301e3e008cb2e530c6a96784b4e20912 100644 (file)
@@ -333,7 +333,7 @@ isis_zebra_route_add_ipv6 (struct prefix *prefix,
 {
   struct zapi_ipv6 api;
   struct in6_addr **nexthop_list;
-  unsigned int *ifindex_list;
+  ifindex_t *ifindex_list;
   struct isis_nexthop6 *nexthop6;
   int i, size;
   struct listnode *node;
@@ -370,7 +370,7 @@ isis_zebra_route_add_ipv6 (struct prefix *prefix,
 
   /* allocate memory for ifindex_list */
   size = sizeof (unsigned int) * listcount (route_info->nexthops6);
-  ifindex_list = (unsigned int *) XMALLOC (MTYPE_ISIS_TMP, size);
+  ifindex_list = (ifindex_t *) XMALLOC (MTYPE_ISIS_TMP, size);
   if (!ifindex_list)
     {
       zlog_err ("isis_zebra_add_route_ipv6: out of memory!");
@@ -420,7 +420,7 @@ isis_zebra_route_del_ipv6 (struct prefix *prefix,
 {
   struct zapi_ipv6 api;
   struct in6_addr **nexthop_list;
-  unsigned int *ifindex_list;
+  ifindex_t *ifindex_list;
   struct isis_nexthop6 *nexthop6;
   int i, size;
   struct listnode *node;
@@ -451,7 +451,7 @@ isis_zebra_route_del_ipv6 (struct prefix *prefix,
 
   /* allocate memory for ifindex_list */
   size = sizeof (unsigned int) * listcount (route_info->nexthops6);
-  ifindex_list = (unsigned int *) XMALLOC (MTYPE_ISIS_TMP, size);
+  ifindex_list = (ifindex_t *) XMALLOC (MTYPE_ISIS_TMP, size);
   if (!ifindex_list)
     {
       zlog_err ("isis_zebra_route_del_ipv6: out of memory!");
index 8f1461326ff27587d03eac47d9ada0943705aed4..2c63c985dcaf0d908ea8ead7fe6019684acd5a8b 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -226,41 +226,41 @@ if_add_hook (int type, int (*func)(struct interface *ifp))
 
 /* Interface existance check by index. */
 struct interface *
-if_lookup_by_index_vrf (unsigned int index, vrf_id_t vrf_id)
+if_lookup_by_index_vrf (ifindex_t ifindex, vrf_id_t vrf_id)
 {
   struct listnode *node;
   struct interface *ifp;
 
   for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp))
     {
-      if (ifp->ifindex == index)
+      if (ifp->ifindex == ifindex)
        return ifp;
     }
   return NULL;
 }
 
 struct interface *
-if_lookup_by_index (unsigned int index)
+if_lookup_by_index (ifindex_t ifindex)
 {
-  return if_lookup_by_index_vrf (index, VRF_DEFAULT);
+  return if_lookup_by_index_vrf (ifindex, VRF_DEFAULT);
 }
 
 const char *
-ifindex2ifname_vrf (unsigned int index, vrf_id_t vrf_id)
+ifindex2ifname_vrf (ifindex_t ifindex, vrf_id_t vrf_id)
 {
   struct interface *ifp;
 
-  return ((ifp = if_lookup_by_index_vrf (index, vrf_id)) != NULL) ?
+  return ((ifp = if_lookup_by_index_vrf (ifindex, vrf_id)) != NULL) ?
         ifp->name : "unknown";
 }
 
 const char *
-ifindex2ifname (unsigned int index)
+ifindex2ifname (ifindex_t ifindex)
 {
-  return ifindex2ifname_vrf (index, VRF_DEFAULT);
+  return ifindex2ifname_vrf (ifindex, VRF_DEFAULT);
 }
 
-unsigned int
+ifindex_t
 ifname2ifindex_vrf (const char *name, vrf_id_t vrf_id)
 {
   struct interface *ifp;
@@ -269,7 +269,7 @@ ifname2ifindex_vrf (const char *name, vrf_id_t vrf_id)
                                                    : IFINDEX_INTERNAL;
 }
 
-unsigned int
+ifindex_t
 ifname2ifindex (const char *name)
 {
   return ifname2ifindex_vrf (name, VRF_DEFAULT);
@@ -1167,7 +1167,7 @@ connected_add_by_prefix (struct interface *ifp, struct prefix *p,
 }
 
 #ifndef HAVE_IF_NAMETOINDEX
-unsigned int
+ifindex_t
 if_nametoindex (const char *name)
 {
   struct interface *ifp;
@@ -1179,7 +1179,7 @@ if_nametoindex (const char *name)
 
 #ifndef HAVE_IF_INDEXTONAME
 char *
-if_indextoname (unsigned int ifindex, char *name)
+if_indextoname (ifindex_t ifindex, char *name)
 {
   struct interface *ifp;
 
@@ -1244,7 +1244,7 @@ ifaddr_ipv4_delete (struct in_addr *ifaddr, struct interface *ifp)
 
 /* Lookup interface by interface's IP address or interface index. */
 static struct interface *
-ifaddr_ipv4_lookup (struct in_addr *addr, unsigned int ifindex)
+ifaddr_ipv4_lookup (struct in_addr *addr, ifindex_t ifindex)
 {
   struct prefix_ipv4 p;
   struct route_node *rn;
index 4ec85bc84179ebe5b5db3b34b642aee40682bfb8..35d91f0cfa84f2b309ce400b946c0f231f7d80dc 100644 (file)
--- a/lib/if.h
+++ b/lib/if.h
@@ -21,6 +21,7 @@ Boston, MA 02111-1307, USA.  */
 #ifndef _ZEBRA_IF_H
 #define _ZEBRA_IF_H
 
+#include "zebra.h"
 #include "linklist.h"
 
 /*
@@ -36,6 +37,8 @@ Boston, MA 02111-1307, USA.  */
 #define INTERFACE_NAMSIZ      20
 #define INTERFACE_HWADDR_MAX  20
 
+typedef signed int ifindex_t;
+
 #ifdef HAVE_PROC_NET_DEV
 struct if_stats
 {
@@ -82,9 +85,9 @@ struct interface
 
   /* Interface index (should be IFINDEX_INTERNAL for non-kernel or
      deleted interfaces). */
-  unsigned int ifindex;
+  ifindex_t ifindex;
 #define IFINDEX_INTERNAL       0
-#define IFINDEX_DELETED         UINT_MAX
+#define IFINDEX_DELETED         INT_MAX
 
   /* Zebra internal interface status */
   u_char status;
@@ -264,7 +267,7 @@ struct nbr_connected
 /* Prototypes. */
 extern int if_cmp_name_func (char *, char *);
 extern struct interface *if_create (const char *name, int namelen);
-extern struct interface *if_lookup_by_index (unsigned int);
+extern struct interface *if_lookup_by_index (ifindex_t);
 extern struct interface *if_lookup_exact_address (void *matchaddr, int family);
 extern struct interface *if_lookup_address (void *matchaddr, int family);
 extern struct interface *if_lookup_prefix (struct prefix *prefix);
@@ -273,8 +276,7 @@ extern void if_update_vrf (struct interface *, const char *name, int namelen,
                                 vrf_id_t vrf_id);
 extern struct interface *if_create_vrf (const char *name, int namelen,
                                 vrf_id_t vrf_id);
-extern struct interface *if_lookup_by_index_vrf (unsigned int,
-                                vrf_id_t vrf_id);
+extern struct interface *if_lookup_by_index_vrf (ifindex_t, vrf_id_t vrf_id);
 extern struct interface *if_lookup_exact_address_vrf (void *matchaddr, int family,
                                 vrf_id_t vrf_id);
 extern struct interface *if_lookup_address_vrf (void *matchaddr, int family,
@@ -332,14 +334,14 @@ extern const char *if_flag_dump(unsigned long);
 /* Please use ifindex2ifname instead of if_indextoname where possible;
    ifindex2ifname uses internal interface info, whereas if_indextoname must
    make a system call. */
-extern const char *ifindex2ifname (unsigned int);
-extern const char *ifindex2ifname_vrf (unsigned int, vrf_id_t vrf_id);
+extern const char *ifindex2ifname (ifindex_t);
+extern const char *ifindex2ifname_vrf (ifindex_t, vrf_id_t vrf_id);
 
 /* Please use ifname2ifindex instead of if_nametoindex where possible;
    ifname2ifindex uses internal interface info, whereas if_nametoindex must
    make a system call. */
-extern unsigned int ifname2ifindex(const char *ifname);
-extern unsigned int ifname2ifindex_vrf(const char *ifname, vrf_id_t vrf_id);
+extern ifindex_t ifname2ifindex(const char *ifname);
+extern ifindex_t ifname2ifindex_vrf(const char *ifname, vrf_id_t vrf_id);
 
 /* Connected address functions. */
 extern struct connected *connected_new (void);
@@ -359,10 +361,10 @@ extern void nbr_connected_free (struct nbr_connected *);
 struct nbr_connected *nbr_connected_check (struct interface *, struct prefix *);
 
 #ifndef HAVE_IF_NAMETOINDEX
-extern unsigned int if_nametoindex (const char *);
+extern ifindex_t if_nametoindex (const char *);
 #endif
 #ifndef HAVE_IF_INDEXTONAME
-extern char *if_indextoname (unsigned int, char *);
+extern char *if_indextoname (ifindex_t, char *);
 #endif
 
 /* Exported variables. */
index eb9b27ea9e3250957e247471c36b219d68d7fbab..4445c4ad27a93dfe1323180dee2e86bb2ce6b560 100644 (file)
@@ -48,7 +48,7 @@ struct nexthop
   struct nexthop *prev;
 
   /* Interface index. */
-  unsigned int ifindex;
+  ifindex_t ifindex;
 
   enum nexthop_types_t type;
 
index d8204936f9044737efd3edd8baa27e32b55e4cf6..31b2edbacfef881331e0f37451c8f77e27f6863a 100644 (file)
@@ -221,7 +221,7 @@ setsockopt_ipv4_multicast(int sock,
                        int optname, 
                        struct in_addr if_addr,
                        unsigned int mcast_addr,
-                       unsigned int ifindex)
+                       ifindex_t ifindex)
 {
 #ifdef HAVE_RFC3678
   struct group_req gr;
@@ -322,7 +322,7 @@ setsockopt_ipv4_multicast(int sock,
  */
 int
 setsockopt_ipv4_multicast_if(int sock, struct in_addr if_addr,
-                       unsigned int ifindex)
+                            ifindex_t ifindex)
 {
 
 #ifdef HAVE_STRUCT_IP_MREQN_IMR_IFINDEX
@@ -352,7 +352,7 @@ setsockopt_ipv4_multicast_if(int sock, struct in_addr if_addr,
 }
   
 static int
-setsockopt_ipv4_ifindex (int sock, int val)
+setsockopt_ipv4_ifindex (int sock, ifindex_t val)
 {
   int ret;
 
@@ -388,7 +388,7 @@ setsockopt_ipv4_tos(int sock, int tos)
 
 
 int
-setsockopt_ifindex (int af, int sock, int val)
+setsockopt_ifindex (int af, int sock, ifindex_t val)
 {
   int ret = -1;
   
@@ -415,11 +415,11 @@ setsockopt_ifindex (int af, int sock, int val)
  * Returns the interface index (small integer >= 1) if it can be
  * determined, or else 0.
  */
-static int
+static ifindex_t
 getsockopt_ipv4_ifindex (struct msghdr *msgh)
 {
   /* XXX: initialize to zero?  (Always overwritten, so just cosmetic.) */
-  int ifindex = -1;
+  ifindex_t ifindex = -1;
 
 #if defined(IP_PKTINFO)
 /* Linux pktinfo based ifindex retrieval */
@@ -439,7 +439,7 @@ getsockopt_ipv4_ifindex (struct msghdr *msgh)
   struct sockaddr_dl *sdl;
 #else
   /* SUNOS_5 uses an integer with the index. */
-  int *ifindex_p;
+  ifindex_t *ifindex_p;
 #endif /* SUNOS_5 */
 
 #ifndef SUNOS_5
@@ -480,7 +480,7 @@ getsockopt_ipv4_ifindex (struct msghdr *msgh)
 }
 
 /* return ifindex, 0 if none found */
-int
+ifindex_t
 getsockopt_ifindex (int af, struct msghdr *msgh)
 {
   switch (af)
index a597314c3d29f99191efd5272825f36b07ccfe0b..d67b510b66b36d4e227601d6322dae53d7c9083c 100644 (file)
@@ -84,16 +84,16 @@ extern int setsockopt_ipv6_tclass (int, int);
                     ? SOPT_SIZE_CMSG_PKTINFO_IPV6())
 
 extern int setsockopt_ipv4_multicast_if(int sock, struct in_addr if_addr,
-                                    unsigned int ifindex);
+                                       ifindex_t ifindex);
 extern int setsockopt_ipv4_multicast(int sock, int optname,
                                      struct in_addr if_addr,
                                      unsigned int mcast_addr,
-                                    unsigned int ifindex);
+                                    ifindex_t ifindex);
 extern int setsockopt_ipv4_tos(int sock, int tos);
 
 /* Ask for, and get, ifindex, by whatever method is supported. */
-extern int setsockopt_ifindex (int, int, int);
-extern int getsockopt_ifindex (int, struct msghdr *);
+extern int setsockopt_ifindex (int, int, ifindex_t);
+extern ifindex_t getsockopt_ifindex (int, struct msghdr *);
 
 /* swab the fields in iph between the host order and system order expected 
  * for IP_HDRINCL.
index b5a2eb954add022b7f269e034fd6ae71a60d4265..9184e500fc81a058beda694ac2b7885f0fbe3a2b 100644 (file)
@@ -291,7 +291,7 @@ sockunion_sizeof (const union sockunion *su)
    1 : connect is in progress */
 enum connect_result
 sockunion_connect (int fd, const union sockunion *peersu, unsigned short port,
-                  unsigned int ifindex)
+                  ifindex_t ifindex)
 {
   int ret;
   int val;
index a33051ae57775a26f56f4379ce8a07ecd5f81d3c..105b11a24c5afc03da6905cfdbcdc17b8632f91c 100644 (file)
@@ -24,6 +24,7 @@
 #define _ZEBRA_SOCKUNION_H
 
 #include "privs.h"
+#include "if.h"
 
 union sockunion 
 {
@@ -95,7 +96,7 @@ extern int sockunion_socket (const union sockunion *su);
 extern const char *inet_sutop (const union sockunion *su, char *str);
 extern enum connect_result sockunion_connect (int fd, const union sockunion *su, 
                                               unsigned short port,
-                                              unsigned int);
+                                              ifindex_t);
 extern union sockunion *sockunion_getsockname (int);
 extern union sockunion *sockunion_getpeername (int);
 extern union sockunion *sockunion_dup (const union sockunion *);
index ef9516c912fc6df81e891550b8b7ff2f3b0a8da1..a28db083cbbfa9d44dd38e54f00151ac057286b0 100644 (file)
@@ -1133,7 +1133,7 @@ memconstant(const void *s, int c, size_t n)
 struct connected *
 zebra_interface_address_read (int type, struct stream *s, vrf_id_t vrf_id)
 {
-  unsigned int ifindex;
+  ifindex_t ifindex;
   struct interface *ifp;
   struct connected *ifc;
   struct prefix p, d;
index f30190c1b42a557584623da0782a7fce7c23c10d..8926bbbe63d6ad1576421a3e972bfbab1bf51c41 100644 (file)
@@ -146,7 +146,7 @@ struct zapi_ipv4
   struct in_addr **nexthop;
 
   u_char ifindex_num;
-  unsigned int *ifindex;
+  ifindex_t *ifindex;
 
   u_char distance;
 
@@ -229,7 +229,7 @@ struct zapi_ipv6
   struct in6_addr **nexthop;
 
   u_char ifindex_num;
-  unsigned int *ifindex;
+  ifindex_t *ifindex;
 
   u_char distance;
 
index 1207419e58675c067276d17a69fccab46b605816..208d3b8c4c54d39b020eebbfbd1a5e846240fca5 100644 (file)
@@ -426,7 +426,7 @@ ospf6_asbr_send_externals_to_area (struct ospf6_area *oa)
 }
 
 void
-ospf6_asbr_redistribute_add (int type, int ifindex, struct prefix *prefix,
+ospf6_asbr_redistribute_add (int type, ifindex_t ifindex, struct prefix *prefix,
                              u_int nexthop_num, struct in6_addr *nexthop)
 {
   int ret;
@@ -575,7 +575,8 @@ ospf6_asbr_redistribute_add (int type, int ifindex, struct prefix *prefix,
 }
 
 void
-ospf6_asbr_redistribute_remove (int type, int ifindex, struct prefix *prefix)
+ospf6_asbr_redistribute_remove (int type, ifindex_t ifindex,
+                                struct prefix *prefix)
 {
   struct ospf6_route *match;
   struct ospf6_external_info *info = NULL;
index 90befdc0dd27b7b3d2c8fdfff29551379ffffd20..645e8fd9cf2bb00fa752ef46c324cb4ccc92b268 100644 (file)
@@ -49,7 +49,7 @@ struct ospf6_external_info
   struct in6_addr forwarding;
   /* u_int32_t tag; */
 
-  unsigned int ifindex;
+  ifindex_t ifindex;
 };
 
 /* AS-External-LSA */
@@ -79,11 +79,11 @@ extern void ospf6_asbr_lsentry_add (struct ospf6_route *asbr_entry);
 extern void ospf6_asbr_lsentry_remove (struct ospf6_route *asbr_entry);
 
 extern int ospf6_asbr_is_asbr (struct ospf6 *o);
-extern void ospf6_asbr_redistribute_add (int type, int ifindex,
+extern void ospf6_asbr_redistribute_add (int type, ifindex_t ifindex,
                                          struct prefix *prefix,
                                          u_int nexthop_num,
                                          struct in6_addr *nexthop);
-extern void ospf6_asbr_redistribute_remove (int type, int ifindex,
+extern void ospf6_asbr_redistribute_remove (int type, ifindex_t ifindex,
                                             struct prefix *prefix);
 
 extern int ospf6_redistribute_config_write (struct vty *vty);
index 720a3e0e697d2a02fbdd9022843f25b9906bdf39..f24ec46da70de9bda8c2ea811fbae6c1140c2116 100644 (file)
@@ -61,7 +61,7 @@ const char *ospf6_interface_state_str[] =
 };
 
 struct ospf6_interface *
-ospf6_interface_lookup_by_ifindex (int ifindex)
+ospf6_interface_lookup_by_ifindex (ifindex_t ifindex)
 {
   struct ospf6_interface *oi;
   struct interface *ifp;
index 5e6b45568295d16a10de361548d91b99260fd6c9..3e09bfb9301610e35d27102127f0ed467a03b24c 100644 (file)
@@ -152,7 +152,7 @@ extern const char *ospf6_interface_state_str[];
 
 /* Function Prototypes */
 
-extern struct ospf6_interface *ospf6_interface_lookup_by_ifindex (int);
+extern struct ospf6_interface *ospf6_interface_lookup_by_ifindex (ifindex_t);
 extern struct ospf6_interface *ospf6_interface_create (struct interface *);
 extern void ospf6_interface_delete (struct ospf6_interface *);
 
index fe57f2f4236c0b81e50227399c12b9dd22893522..b0e94288b4ce094763d4bed732afd3f3a2b55780 100644 (file)
@@ -290,7 +290,7 @@ ospf6_hello_recv (struct in6_addr *src, struct in6_addr *dst,
   memcpy (&on->linklocal_addr, src, sizeof (struct in6_addr));
 
   /* Neighbor ifindex check */
-  if (on->ifindex != ntohl (hello->interface_id))
+  if (on->ifindex != (ifindex_t)ntohl (hello->interface_id))
     {
       on->ifindex = ntohl (hello->interface_id);
       neighbor_ifindex_change++;
@@ -1525,7 +1525,7 @@ ospf6_receive (struct thread *thread)
   unsigned int len;
   char srcname[64], dstname[64];
   struct in6_addr src, dst;
-  unsigned int ifindex;
+  ifindex_t ifindex;
   struct iovec iovector[2];
   struct ospf6_interface *oi;
   struct ospf6_header *oh;
index b085a9673b33bc48ec232f26ee49c3618ce5892f..4a9e0c7a66925b9193b586cbacf4fd4a9c6c711d 100644 (file)
@@ -64,7 +64,7 @@ struct ospf6_header
 #define OSPF6_HELLO_MIN_SIZE                  20U
 struct ospf6_hello
 {
-  u_int32_t interface_id;
+  ifindex_t interface_id;
   u_char    priority;
   u_char    options[3];
   u_int16_t hello_interval;
index fad7fd578a562defaab68c9feea5c3bf8b3df6dc..f9e197e99bbd03b251864be9744e9ef3c06791fd 100644 (file)
@@ -53,7 +53,7 @@ struct ospf6_neighbor
   u_int32_t router_id;
 
   /* Neighbor Interface ID */
-  u_int32_t ifindex;
+  ifindex_t ifindex;
 
   /* Router Priority of this neighbor */
   u_char priority;
index 5e254661f149fb091ca9ee156fc6c259a37d495b..2227d03477172bf3b033b7ca5e30a401b5cd4de8 100644 (file)
@@ -113,7 +113,7 @@ ospf6_serv_sock (void)
 
 /* ospf6 set socket option */
 int
-ospf6_sso (u_int ifindex, struct in6_addr *group, int option)
+ospf6_sso (ifindex_t ifindex, struct in6_addr *group, int option)
 {
   struct ipv6_mreq mreq6;
   int ret;
@@ -193,7 +193,7 @@ iov_totallen (struct iovec *iov)
 
 int
 ospf6_sendmsg (struct in6_addr *src, struct in6_addr *dst,
-               unsigned int *ifindex, struct iovec *message)
+               ifindex_t *ifindex, struct iovec *message)
 {
   int retval;
   struct msghdr smsghdr;
@@ -255,7 +255,7 @@ ospf6_sendmsg (struct in6_addr *src, struct in6_addr *dst,
 
 int
 ospf6_recvmsg (struct in6_addr *src, struct in6_addr *dst,
-               unsigned int *ifindex, struct iovec *message)
+               ifindex_t *ifindex, struct iovec *message)
 {
   int retval;
   struct msghdr rmsghdr;
index 2aeafe50416620dbf21b0be24265dee14e8d189e..4fa2839519f42e0473c774db34b5ed00ee7522e3 100644 (file)
@@ -29,12 +29,12 @@ extern struct in6_addr allspfrouters6;
 extern struct in6_addr alldrouters6;
 
 extern int ospf6_serv_sock (void);
-extern int ospf6_sso (u_int ifindex, struct in6_addr *group, int option);
+extern int ospf6_sso (ifindex_t ifindex, struct in6_addr *group, int option);
 
 extern int ospf6_sendmsg (struct in6_addr *, struct in6_addr *,
-                          unsigned int *, struct iovec *);
+                          ifindex_t *, struct iovec *);
 extern int ospf6_recvmsg (struct in6_addr *, struct in6_addr *,
-                          unsigned int *, struct iovec *);
+                          ifindex_t *, struct iovec *);
 
 #endif /* OSPF6_NETWORK_H */
 
index 0a98c8f082aa8c23c049a60961ff6a97bcb5bdd3..5172eee48d38bbbfd99af43e09f9320b399781bd 100644 (file)
@@ -331,7 +331,7 @@ ospf6_add_nexthop (struct list *nh_list, int ifindex,
 
 void
 ospf6_route_zebra_copy_nexthops (struct ospf6_route *route,
-                                unsigned int *ifindexes,
+                                ifindex_t *ifindexes,
                                 struct in6_addr **nexthop_addr,
                                 int entries)
 {
index e783b72d8e8de22e92a25b96ba844b064a3612fa..610b0970b0ea707f1f35534a85cb1aea0a610438 100644 (file)
@@ -41,7 +41,7 @@ extern unsigned char conf_debug_ospf6_route;
 struct ospf6_nexthop
 {
   /* Interface index */
-  unsigned int ifindex;
+  ifindex_t ifindex;
 
   /* IP address, if any */
   struct in6_addr address;
@@ -278,7 +278,7 @@ extern int ospf6_num_nexthops (struct list *nh_list);
 extern int ospf6_route_cmp_nexthops (struct ospf6_route *a,
                                     struct ospf6_route *b);
 extern void ospf6_route_zebra_copy_nexthops (struct ospf6_route *route,
-                                            unsigned int *ifindices,
+                                            ifindex_t *ifindices,
                                             struct in6_addr **addr,
                                             int entries);
 extern int ospf6_route_get_first_nh_index (struct ospf6_route *route);
index cf1630bbc99fe2f781e17b9822e7813cd7d8dddd..382cf62f72cad407f5c34541ba629603de4a49d6 100644 (file)
@@ -625,7 +625,7 @@ ospfv3WwLsdbEntry (struct variable *v, oid *name, size_t *length,
                      int exact, size_t *var_len, WriteMethod **write_method)
 {
   struct ospf6_lsa *lsa = NULL;
-  u_int32_t ifindex, area_id, id, instid, adv_router;
+  ifindex_t ifindex, area_id, id, instid, adv_router;
   u_int16_t type;
   int len;
   oid *offset;
@@ -837,7 +837,8 @@ static u_char *
 ospfv3IfEntry (struct variable *v, oid *name, size_t *length,
                int exact, size_t *var_len, WriteMethod **write_method)
 {
-  unsigned int ifindex, instid;
+  ifindex_t ifindex = 0;
+  unsigned int instid = 0;
   struct ospf6_interface *oi = NULL;
   struct ospf6_lsa *lsa = NULL;
   struct interface      *iif;
@@ -851,8 +852,6 @@ ospfv3IfEntry (struct variable *v, oid *name, size_t *length,
       == MATCH_FAILED)
     return NULL;
 
-  ifindex = instid = 0;
-
   /* Check OSPFv3 instance. */
   if (ospf6 == NULL)
     return NULL;
@@ -990,7 +989,8 @@ static u_char *
 ospfv3NbrEntry (struct variable *v, oid *name, size_t *length,
                int exact, size_t *var_len, WriteMethod **write_method)
 {
-  unsigned int ifindex, instid, rtrid;
+  ifindex_t ifindex = 0;
+  unsigned int instid, rtrid;
   struct ospf6_interface *oi = NULL;
   struct ospf6_neighbor  *on = NULL;
   struct interface      *iif;
@@ -1003,7 +1003,7 @@ ospfv3NbrEntry (struct variable *v, oid *name, size_t *length,
       == MATCH_FAILED)
     return NULL;
 
-  ifindex = instid = rtrid = 0;
+  instid = rtrid = 0;
 
   /* Check OSPFv3 instance. */
   if (ospf6 == NULL)
index ab1213ebb66f5faf8525ba8b8cf847a3e3a25e7d..957988b53d153ae823f3c981229e33b43a5f7ea8 100644 (file)
@@ -266,7 +266,7 @@ ospf6_nexthop_calc (struct ospf6_vertex *w, struct ospf6_vertex *v,
                     caddr_t lsdesc)
 {
   int i;
-  unsigned int ifindex;
+  ifindex_t ifindex;
   struct ospf6_interface *oi;
   u_int16_t type;
   u_int32_t adv_router;
index 0395b082da2efbc74d9021afa2adac882ecc3841..77ea01e53dc76ff7d6bbd23e0bd5127bbd65cfc9 100644 (file)
@@ -377,7 +377,7 @@ ospf6_zebra_route_update (int type, struct ospf6_route *request)
   char buf[PREFIX2STR_BUFFER];
   int nhcount;
   struct in6_addr **nexthops;
-  unsigned int *ifindexes;
+  ifindex_t *ifindexes;
   int ret = 0;
   struct prefix_ipv6 *dest;
 
@@ -443,7 +443,7 @@ ospf6_zebra_route_update (int type, struct ospf6_route *request)
 
   /* allocate memory for ifindex_list */
   ifindexes = XCALLOC (MTYPE_OSPF6_OTHER,
-                       nhcount * sizeof (unsigned int));
+                       nhcount * sizeof (ifindex_t));
   if (ifindexes == NULL)
     {
       zlog_warn ("Can't send route to zebra: malloc failed");
index ddb26dd5433ae153c0f3ebc151a71f3ddc447b53..21f99af1284efaab390b79474fd6d620a7d5ead9 100644 (file)
@@ -136,7 +136,7 @@ ospf_route_map_set_compare (struct route_map_set_values *values1,
 /* Add an External info for AS-external-LSA. */
 struct external_info *
 ospf_external_info_add (u_char type, u_short instance, struct prefix_ipv4 p,
-                       unsigned int ifindex, struct in_addr nexthop,
+                       ifindex_t ifindex, struct in_addr nexthop,
                         u_short tag)
 {
   struct external_info *new;
index ade671013ac21588a5ee41c6e07a79b8e24a530b..25a53aad4fe65304d1ff5aebec6771a6289d487c 100644 (file)
@@ -41,7 +41,7 @@ struct external_info
   struct prefix_ipv4 p;
 
   /* Interface index. */
-  unsigned int ifindex;
+  ifindex_t ifindex;
 
   /* Nexthop address. */
   struct in_addr nexthop;
@@ -63,7 +63,7 @@ extern int ospf_route_map_set_compare (struct route_map_set_values *,
                                struct route_map_set_values *);
 extern struct external_info *ospf_external_info_add (u_char, u_short,
                                               struct prefix_ipv4,
-                                             unsigned int, 
+                                             ifindex_t,
                                              struct in_addr,
                                              u_short);
 extern void ospf_external_info_delete (u_char, u_short, struct prefix_ipv4);
index 68a3946b3a6ffa090e5eabae31f7dc2179467abd..b96ed452c149b84723f3569daeb31ca417799f3d 100644 (file)
@@ -2251,7 +2251,7 @@ ospf_nssa_lsa_flush (struct ospf *ospf, struct prefix_ipv4 *p)
 void
 ospf_external_lsa_flush (struct ospf *ospf,
                         u_char type, struct prefix_ipv4 *p,
-                        unsigned int ifindex /*, struct in_addr nexthop */)
+                        ifindex_t ifindex /*, struct in_addr nexthop */)
 {
   struct ospf_lsa *lsa;
 
index b3d72109d6aca6283e28156a0c82063ac86caa7f..28ecc9d4d62458a417a05068239f495363cfaa9f 100644 (file)
@@ -277,7 +277,7 @@ extern struct ospf_lsa *ospf_lsa_install (struct ospf *,
 
 extern void ospf_nssa_lsa_flush (struct ospf *ospf, struct prefix_ipv4 *p);
 extern void ospf_external_lsa_flush (struct ospf *, u_char, struct prefix_ipv4 *,
-                             unsigned int /* , struct in_addr nexthop */);
+                                    ifindex_t /* , struct in_addr nexthop */);
 
 extern struct in_addr ospf_get_ip_from_ifp (struct ospf_interface *);
 
index 9f516d739055dc1f36854d2b1d0335ec6dc0d387..6caa38d68b163da0f3b01d37eaa93f99a3c754da 100644 (file)
@@ -48,7 +48,7 @@ extern struct zebra_privs_t ospfd_privs;
 /* Join to the OSPF ALL SPF ROUTERS multicast group. */
 int
 ospf_if_add_allspfrouters (struct ospf *top, struct prefix *p,
-                          unsigned int ifindex)
+                          ifindex_t ifindex)
 {
   int ret;
   
@@ -69,7 +69,7 @@ ospf_if_add_allspfrouters (struct ospf *top, struct prefix *p,
 
 int
 ospf_if_drop_allspfrouters (struct ospf *top, struct prefix *p,
-                           unsigned int ifindex)
+                           ifindex_t ifindex)
 {
   int ret;
 
@@ -89,8 +89,7 @@ ospf_if_drop_allspfrouters (struct ospf *top, struct prefix *p,
 
 /* Join to the OSPF ALL Designated ROUTERS multicast group. */
 int
-ospf_if_add_alldrouters (struct ospf *top, struct prefix *p, unsigned int
-                        ifindex)
+ospf_if_add_alldrouters (struct ospf *top, struct prefix *p, ifindex_t ifindex)
 {
   int ret;
 
@@ -110,8 +109,7 @@ ospf_if_add_alldrouters (struct ospf *top, struct prefix *p, unsigned int
 }
 
 int
-ospf_if_drop_alldrouters (struct ospf *top, struct prefix *p, unsigned int
-                         ifindex)
+ospf_if_drop_alldrouters (struct ospf *top, struct prefix *p, ifindex_t ifindex)
 {
   int ret;
 
@@ -130,7 +128,7 @@ ospf_if_drop_alldrouters (struct ospf *top, struct prefix *p, unsigned int
 }
 
 int
-ospf_if_ipmulticast (struct ospf *top, struct prefix *p, unsigned int ifindex)
+ospf_if_ipmulticast (struct ospf *top, struct prefix *p, ifindex_t ifindex)
 {
   u_char val;
   int ret, len;
index e0a5c69d5cdb5520c7f0c2b63b801b58d1463704..8257adb4af777c2713d7a6f7fc93fba73184bfe5 100644 (file)
 
 /* Prototypes. */
 extern int ospf_if_add_allspfrouters (struct ospf *, struct prefix *,
-                                     unsigned int);
+                                     ifindex_t);
 extern int ospf_if_drop_allspfrouters (struct ospf *, struct prefix *,
-                                      unsigned int);
+                                      ifindex_t);
 extern int ospf_if_add_alldrouters (struct ospf *, struct prefix *,
-                                   unsigned int);
+                                   ifindex_t);
 extern int ospf_if_drop_alldrouters (struct ospf *, struct prefix *,
-                                    unsigned int);
-extern int ospf_if_ipmulticast (struct ospf *, struct prefix *, unsigned int);
+                                    ifindex_t);
+extern int ospf_if_ipmulticast (struct ospf *, struct prefix *, ifindex_t);
 extern int ospf_sock_init (void);
 extern void ospf_adjust_sndbuflen (struct ospf *, unsigned int);
 
index 2df1596ee325063bd5601ce27d804c15915429d4..e6014a14c6d4bd1936888d6756c2e1ab662344c4 100644 (file)
@@ -2143,7 +2143,7 @@ ospf_recv_packet (int fd, struct interface **ifp, struct stream *ibuf)
   int ret;
   struct ip *iph;
   u_int16_t ip_len;
-  unsigned int ifindex = 0;
+  ifindex_t ifindex = 0;
   struct iovec iov;
   /* Header and data both require alignment. */
   char buff [CMSG_SPACE(SOPT_SIZE_CMSG_IFINDEX_IPV4())];
index d0b121db3871e501072d9065cc278e38063f2e1c..6b6d9f1fabd4129bc63f8f88e51fb0978199425a 100644 (file)
@@ -39,7 +39,7 @@ struct ospf_path
 {
   struct in_addr nexthop;
   struct in_addr adv_router;
-  unsigned int ifindex;
+  ifindex_t ifindex;
   unsigned char unnumbered;
 };
 
index bedcb559bf5fa554d99b84cfde2df1d40042acc1..676756d6d9e2cd0386554e0968d68a3692018173 100644 (file)
@@ -1413,7 +1413,7 @@ static struct list *ospf_snmp_iflist;
 struct ospf_snmp_if
 {
   struct in_addr addr;
-  unsigned int ifindex;
+  ifindex_t ifindex;
   struct interface *ifp;
 };
 
@@ -1455,7 +1455,7 @@ ospf_snmp_if_update (struct interface *ifp)
   struct prefix *p;
   struct ospf_snmp_if *osif;
   struct in_addr *addr;
-  unsigned int ifindex;
+  ifindex_t ifindex;
 
   ospf_snmp_if_delete (ifp);
 
@@ -1530,7 +1530,7 @@ ospf_snmp_is_if_have_addr (struct interface *ifp)
 }
 
 static struct ospf_interface *
-ospf_snmp_if_lookup (struct in_addr *ifaddr, unsigned int *ifindex)
+ospf_snmp_if_lookup (struct in_addr *ifaddr, ifindex_t *ifindex)
 {
   struct listnode *node;
   struct ospf_snmp_if *osif;
@@ -1554,8 +1554,8 @@ ospf_snmp_if_lookup (struct in_addr *ifaddr, unsigned int *ifindex)
 }
 
 static struct ospf_interface *
-ospf_snmp_if_lookup_next (struct in_addr *ifaddr, unsigned int *ifindex,
-                         int ifaddr_next, int ifindex_next)
+ospf_snmp_if_lookup_next (struct in_addr *ifaddr, ifindex_t *ifindex,
+                         int ifaddr_next, ifindex_t ifindex_next)
 {
   struct ospf_snmp_if *osif;
   struct listnode *nn;
@@ -1638,11 +1638,11 @@ ospf_snmp_iftype (struct interface *ifp)
 
 static struct ospf_interface *
 ospfIfLookup (struct variable *v, oid *name, size_t *length,
-             struct in_addr *ifaddr, unsigned int *ifindex, int exact)
+             struct in_addr *ifaddr, ifindex_t *ifindex, int exact)
 {
   unsigned int len;
   int ifaddr_next = 0;
-  int ifindex_next = 0;
+  ifindex_t ifindex_next = 0;
   struct ospf_interface *oi;
   oid *offset;
 
@@ -1694,7 +1694,7 @@ static u_char *
 ospfIfEntry (struct variable *v, oid *name, size_t *length, int exact,
             size_t *var_len, WriteMethod **write_method)
 {
-  unsigned int ifindex;
+  ifindex_t ifindex;
   struct in_addr ifaddr;
   struct ospf_interface *oi;
   struct ospf *ospf;
@@ -1802,11 +1802,11 @@ ospfIfEntry (struct variable *v, oid *name, size_t *length, int exact,
 
 static struct ospf_interface *
 ospfIfMetricLookup (struct variable *v, oid *name, size_t *length,
-                   struct in_addr *ifaddr, unsigned int *ifindex, int exact)
+                   struct in_addr *ifaddr, ifindex_t *ifindex, int exact)
 {
   unsigned int len;
   int ifaddr_next = 0;
-  int ifindex_next = 0;
+  ifindex_t ifindex_next = 0;
   struct ospf_interface *oi;
   oid *offset;
   int metric;
@@ -1866,7 +1866,7 @@ ospfIfMetricEntry (struct variable *v, oid *name, size_t *length, int exact,
                   size_t *var_len, WriteMethod **write_method)
 {
   /* Currently we support metric 1 only. */
-  unsigned int ifindex;
+  ifindex_t ifindex;
   struct in_addr ifaddr;
   struct ospf_interface *oi;
   struct ospf *ospf;
@@ -2133,7 +2133,7 @@ ospfVirtIfEntry (struct variable *v, oid *name, size_t *length, int exact,
 
 static struct ospf_neighbor *
 ospf_snmp_nbr_lookup (struct ospf *ospf, struct in_addr *nbr_addr,
-                     unsigned int *ifindex)
+                     ifindex_t *ifindex)
 {
   struct listnode *node, *nnode;
   struct ospf_interface *oi;
@@ -2161,7 +2161,7 @@ ospf_snmp_nbr_lookup (struct ospf *ospf, struct in_addr *nbr_addr,
 }
 
 static struct ospf_neighbor *
-ospf_snmp_nbr_lookup_next (struct in_addr *nbr_addr, unsigned int *ifindex,
+ospf_snmp_nbr_lookup_next (struct in_addr *nbr_addr, ifindex_t *ifindex,
                           int first)
 {
   struct listnode *nn;
@@ -2208,7 +2208,7 @@ ospf_snmp_nbr_lookup_next (struct in_addr *nbr_addr, unsigned int *ifindex,
 
 static struct ospf_neighbor *
 ospfNbrLookup (struct variable *v, oid *name, size_t *length,
-              struct in_addr *nbr_addr, unsigned int *ifindex, int exact)
+              struct in_addr *nbr_addr, ifindex_t *ifindex, int exact)
 {
   unsigned int len;
   int first;
@@ -2303,7 +2303,7 @@ ospfNbrEntry (struct variable *v, oid *name, size_t *length, int exact,
              size_t *var_len, WriteMethod **write_method)
 {
   struct in_addr nbr_addr;
-  unsigned int ifindex;
+  ifindex_t ifindex;
   struct ospf_neighbor *nbr;
   struct ospf_interface *oi;
 
index 3c602750274e65081788c1873d293ed6ce1211b1..a8a1d088055031efd368f9f7b163302f485d3139 100644 (file)
@@ -772,7 +772,7 @@ void pim_if_del_vif_all()
   }
 }
 
-struct interface *pim_if_find_by_vif_index(int vif_index)
+struct interface *pim_if_find_by_vif_index(ifindex_t vif_index)
 {
   struct listnode  *ifnode;
   struct interface *ifp;
@@ -784,6 +784,7 @@ struct interface *pim_if_find_by_vif_index(int vif_index)
     if (ifp->info) {
       struct pim_interface *pim_ifp;
       pim_ifp = ifp->info;
+
       if (vif_index == pim_ifp->mroute_vif_index)
        return ifp;
     }
@@ -795,7 +796,7 @@ struct interface *pim_if_find_by_vif_index(int vif_index)
 /*
   pim_if_add_vif() uses ifindex as vif_index
  */
-int pim_if_find_vifindex_by_ifindex(int ifindex)
+int pim_if_find_vifindex_by_ifindex(ifindex_t ifindex)
 {
   struct pim_interface *pim_ifp;
   struct interface *ifp;
@@ -954,7 +955,7 @@ static struct igmp_join *igmp_join_find(struct list *join_list,
 }
 
 static int igmp_join_sock(const char *ifname,
-                         int ifindex,
+                         ifindex_t ifindex,
                          struct in_addr group_addr,
                          struct in_addr source_addr)
 {
index 15489f81fa79e1dde0c9d856243d039a1bcf0ae6..790afabea162813080728fa60326e74fdf73e4bd 100644 (file)
@@ -63,7 +63,7 @@ enum pim_interface_type {
 struct pim_interface {
   enum pim_interface_type itype;
   uint32_t       options;                            /* bit vector */
-  int            mroute_vif_index;
+  ifindex_t      mroute_vif_index;
   struct in_addr primary_address; /* remember addr to detect change */
 
   int          igmp_default_robustness_variable;            /* IGMPv3 QRV */
@@ -133,8 +133,8 @@ int pim_if_del_vif(struct interface *ifp);
 void pim_if_add_vif_all(void);
 void pim_if_del_vif_all(void);
 
-struct interface *pim_if_find_by_vif_index(int vif_index);
-int pim_if_find_vifindex_by_ifindex(int ifindex);
+struct interface *pim_if_find_by_vif_index(ifindex_t vif_index);
+int pim_if_find_vifindex_by_ifindex(ifindex_t ifindex);
 
 int pim_if_lan_delay_enabled(struct interface *ifp);
 uint16_t pim_if_effective_propagation_delay_msec(struct interface *ifp);
index 440d6487237f5510f71a5165f0770f78f57474ea..3b63b10e0d92badae91425b6c5f36a4975643b15 100644 (file)
@@ -46,7 +46,7 @@
 
 static void group_timer_off(struct igmp_group *group);
 
-static int igmp_sock_open(struct in_addr ifaddr, int ifindex, uint32_t pim_options)
+static int igmp_sock_open(struct in_addr ifaddr, ifindex_t ifindex, uint32_t pim_options)
 {
   int fd;
   int join = 0;
@@ -971,7 +971,7 @@ static int pim_igmp_read(struct thread *t)
   socklen_t tolen = sizeof(to);
   uint8_t buf[PIM_IGMP_BUFSIZE_READ];
   int len;
-  int ifindex = -1;
+  ifindex_t ifindex = -1;
   int result = -1; /* defaults to bad */
 
   zassert(t);
@@ -1009,7 +1009,7 @@ static int pim_igmp_read(struct thread *t)
 
 #ifdef PIM_CHECK_RECV_IFINDEX_SANITY
   /* ifindex sanity check */
-  if (ifindex != (int) igmp->interface->ifindex) {
+  if (ifindex != igmp->interface->ifindex) {
     char from_str[100];
     char to_str[100];
     struct interface *ifp;
@@ -1021,7 +1021,7 @@ static int pim_igmp_read(struct thread *t)
 
     ifp = if_lookup_by_index(ifindex);
     if (ifp) {
-      zassert(ifindex == (int) ifp->ifindex);
+      zassert(ifindex == ifp->ifindex);
     }
 
 #ifdef PIM_REPORT_RECV_IFINDEX_MISMATCH
index 95519ff974c496b6fd113cb60ecacf1f59172833..1700276de86a8469ac097cfce3d311bb4439df4f 100644 (file)
@@ -39,7 +39,7 @@ struct group_source_req
 };
 #endif
 
-static int pim_igmp_join_source(int fd, int ifindex,
+static int pim_igmp_join_source(int fd, ifindex_t ifindex,
                                struct in_addr group_addr,
                                struct in_addr source_addr)
 {
index eedbc116d8f0e699f98de9fa076ae65189511456..0dfd39cd16f1f3dc481a5fc19e371c91ffbd0d81 100644 (file)
@@ -278,7 +278,7 @@ static int pim_sock_read(struct thread *t)
   socklen_t tolen = sizeof(to);
   uint8_t buf[PIM_PIM_BUFSIZE_READ];
   int len;
-  int ifindex = -1;
+  ifindex_t ifindex = -1;
   int result = -1; /* defaults to bad */
 
   zassert(t);
@@ -386,7 +386,7 @@ static void pim_sock_read_on(struct interface *ifp)
                 pim_ifp->pim_sock_fd);
 }
 
-static int pim_sock_open(struct in_addr ifaddr, int ifindex)
+static int pim_sock_open(struct in_addr ifaddr, ifindex_t ifindex)
 {
   int fd;
 
index e04cd4157531a53988b44580650698ab9882a943..a024e3ae015bcc6a3fdfe876fbc5597e87696572 100644 (file)
@@ -213,7 +213,7 @@ int pim_socket_mcast(int protocol, struct in_addr ifaddr, int ifindex, int loop)
 }
 
 int pim_socket_join(int fd, struct in_addr group,
-                   struct in_addr ifaddr, int ifindex)
+                   struct in_addr ifaddr, ifindex_t ifindex)
 {
   int ret;
 
@@ -261,7 +261,7 @@ int pim_socket_join(int fd, struct in_addr group,
   return ret;
 }
 
-int pim_socket_join_source(int fd, int ifindex,
+int pim_socket_join_source(int fd, ifindex_t ifindex,
                           struct in_addr group_addr,
                           struct in_addr source_addr,
                           const char *ifname)
@@ -285,7 +285,7 @@ int pim_socket_join_source(int fd, int ifindex,
 int pim_socket_recvfromto(int fd, uint8_t *buf, size_t len,
                          struct sockaddr_in *from, socklen_t *fromlen,
                          struct sockaddr_in *to, socklen_t *tolen,
-                         int *ifindex)
+                         ifindex_t *ifindex)
 {
   struct msghdr msgh;
   struct cmsghdr *cmsg;
index 9a9b64a4a36e2f422e85e405b4ee23324609d245..f0a16008187a3dd1d4ec9877edcbbd658d8611ea 100644 (file)
 int pim_socket_raw(int protocol);
 int pim_socket_mcast(int protocol, struct in_addr ifaddr, int ifindex, int loop);
 int pim_socket_join(int fd, struct in_addr group,
-                   struct in_addr ifaddr, int ifindex);
-int pim_socket_join_source(int fd, int ifindex,
+                   struct in_addr ifaddr, ifindex_t ifindex);
+int pim_socket_join_source(int fd, ifindex_t ifindex,
                           struct in_addr group_addr,
                           struct in_addr source_addr,
                           const char *ifname);
 int pim_socket_recvfromto(int fd, uint8_t *buf, size_t len,
                          struct sockaddr_in *from, socklen_t *fromlen,
                          struct sockaddr_in *to, socklen_t *tolen,
-                         int *ifindex);
+                         ifindex_t *ifindex);
 
 int pim_socket_mcastloop_get(int fd);
 
index d564bf57bcec6885402d43437f3ad2ce6f121f3a..fe88eba2710f6d369487e2c7f87de7d07c1fff21 100644 (file)
@@ -250,7 +250,7 @@ static int ssmpingd_read_msg(struct ssmpingd_sock *ss)
   struct sockaddr_in to;
   socklen_t fromlen = sizeof(from);
   socklen_t tolen = sizeof(to);
-  int ifindex = -1;
+  ifindex_t ifindex = -1;
   uint8_t buf[1000];
   int len;
 
index 1931f1ee6c964290c316f6e8ed57d5b375410332..c1154dc0881c28c7e2064c6c3afe831d4efdb660 100644 (file)
@@ -85,8 +85,8 @@ int pim_static_add(struct interface *iif, struct interface *oif, struct in_addr
    struct static_route *original_s_route = 0;
    struct pim_interface *pim_iif = iif ? iif->info : 0;
    struct pim_interface *pim_oif = oif ? oif->info : 0;
-   unsigned int iif_index = pim_iif ? pim_iif->mroute_vif_index : 0;
-   unsigned int oif_index = pim_oif ? pim_oif->mroute_vif_index : 0;
+   ifindex_t iif_index = pim_iif ? pim_iif->mroute_vif_index : 0;
+   ifindex_t oif_index = pim_oif ? pim_oif->mroute_vif_index : 0;
 
    if (!iif_index || !oif_index) {
       zlog_warn("%s %s: Unable to add static route: Invalid interface index(iif=%d,oif=%d)",
@@ -229,8 +229,8 @@ int pim_static_del(struct interface *iif, struct interface *oif, struct in_addr
    struct static_route *s_route = 0;
    struct pim_interface *pim_iif = iif ? iif->info : 0;
    struct pim_interface *pim_oif = oif ? oif->info : 0;
-   unsigned int iif_index = pim_iif ? pim_iif->mroute_vif_index : 0;
-   unsigned int oif_index = pim_oif ? pim_oif->mroute_vif_index : 0;
+   ifindex_t iif_index = pim_iif ? pim_iif->mroute_vif_index : 0;
+   ifindex_t oif_index = pim_oif ? pim_oif->mroute_vif_index : 0;
 
    if (!iif_index || !oif_index) {
       zlog_warn("%s %s: Unable to remove static route: Invalid interface index(iif=%d,oif=%d)",
index ff89fb150eed19664f5fe8fb360d34636537e859..07d31d59b75a5cf264c7a42413f36ce1c4528609 100644 (file)
@@ -33,7 +33,7 @@ struct static_route {
    struct in_addr source;
 
    struct channel_oil c_oil;
-   unsigned int   iif;
+   ifindex_t          iif;
    unsigned char  oif_ttls[MAXVIFS];
 };
 
index efab00e2275c1e8c5c0750a1768844dea1b79654..d357e5cc8350885d69f5c7713b2180077061898c 100644 (file)
@@ -533,7 +533,7 @@ static int redist_read_ipv4_route(int command, struct zclient *zclient,
 {
   struct stream *s;
   struct zapi_ipv4 api;
-  unsigned long ifindex;
+  ifindex_t ifindex;
   struct in_addr nexthop;
   struct prefix_ipv4 p;
   int min_len = 4;
@@ -620,7 +620,7 @@ static int redist_read_ipv4_route(int command, struct zclient *zclient,
     if (PIM_DEBUG_ZEBRA) {
       char buf[2][INET_ADDRSTRLEN];
       zlog_debug("%s: add %s %s/%d "
-                "nexthop %s ifindex %ld metric%s %u distance%s %u",
+                "nexthop %s ifindex %d metric%s %u distance%s %u",
                 __PRETTY_FUNCTION__,
                 zebra_route_string(api.type),
                 inet_ntop(AF_INET, &p.prefix, buf[0], sizeof(buf[0])),
@@ -638,7 +638,7 @@ static int redist_read_ipv4_route(int command, struct zclient *zclient,
     if (PIM_DEBUG_ZEBRA) {
       char buf[2][INET_ADDRSTRLEN];
       zlog_debug("%s: delete %s %s/%d "
-                "nexthop %s ifindex %ld metric%s %u distance%s %u",
+                "nexthop %s ifindex %d metric%s %u distance%s %u",
                 __PRETTY_FUNCTION__,
                 zebra_route_string(api.type),
                 inet_ntop(AF_INET, &p.prefix, buf[0], sizeof(buf[0])),
@@ -763,7 +763,7 @@ static int fib_lookup_if_vif_index(struct in_addr addr)
   struct pim_zlookup_nexthop nexthop_tab[PIM_NEXTHOP_IFINDEX_TAB_SIZE];
   int num_ifindex;
   int vif_index;
-  int first_ifindex;
+  ifindex_t first_ifindex;
 
   num_ifindex = zclient_lookup_nexthop(qpim_zclient_lookup, nexthop_tab,
                                       PIM_NEXTHOP_IFINDEX_TAB_SIZE, addr,
index 1f184942ca530a88bc8da5b7b0a0652df134e2bd..f2be6d4fa09c89590fa869a331c6b454ae467f57 100644 (file)
@@ -31,7 +31,7 @@
 
 struct pim_zlookup_nexthop {
   struct in_addr nexthop_addr;
-  int            ifindex;
+  ifindex_t      ifindex;
   uint32_t       route_metric;
   uint8_t        protocol_distance;
 };
index 7fcf38bcec3e5ac766309abd1dfb1a64a2ee55d8..5c4574024b39bb4fe3900de5702b2db9f1467e0e 100644 (file)
@@ -32,6 +32,7 @@
 #include <net/if.h>
 #include <arpa/inet.h>
 
+#include "if.h"
 #include "pim_igmp_join.h"
 
 const char *prog_name = 0;
@@ -39,7 +40,7 @@ const char *prog_name = 0;
 static int iface_solve_index(const char *ifname)
 {
   struct if_nameindex *ini;
-  int ifindex = -1;
+  ifindex_t ifindex = -1;
   int i;
 
   if (!ifname)
@@ -79,7 +80,7 @@ int main(int argc, const char *argv[])
   const char *ifname;
   const char *group;
   const char *source;
-  int ifindex;
+  ifindex_t ifindex;
   int result;
   int fd;
 
index 4499966ad086d15e8dddaf09ae926595febdde8d..09b35d00b986f665e9ac977b18d32a9783ec5900 100644 (file)
@@ -74,7 +74,7 @@ static int
 ipv4_multicast_join (int sock, 
                     struct in_addr group, 
                     struct in_addr ifa,
-                    unsigned int ifindex)
+                    ifindex_t ifindex)
 {
   int ret;
 
@@ -96,7 +96,7 @@ static int
 ipv4_multicast_leave (int sock, 
                      struct in_addr group, 
                      struct in_addr ifa,
-                     unsigned int ifindex)
+                     ifindex_t ifindex)
 {
   int ret;
 
index 42f1015453cceab00426a1b98c2f46825826e683..3a8cd80e7a2ec1acc5e880388cb9d730bfe2cfb5 100644 (file)
@@ -1579,7 +1579,7 @@ rip_send_packet (u_char * buf, int size, struct sockaddr_in *to,
 /* Add redistributed route to RIP table. */
 void
 rip_redistribute_add (int type, int sub_type, struct prefix_ipv4 *p, 
-                     unsigned int ifindex, struct in_addr *nexthop,
+                     ifindex_t ifindex, struct in_addr *nexthop,
                       unsigned int metric, unsigned char distance)
 {
   int ret;
@@ -1653,7 +1653,7 @@ rip_redistribute_add (int type, int sub_type, struct prefix_ipv4 *p,
 /* Delete redistributed route from RIP table. */
 void
 rip_redistribute_delete (int type, int sub_type, struct prefix_ipv4 *p, 
-                          unsigned int ifindex)
+                        ifindex_t ifindex)
 {
   int ret;
   struct route_node *rp;
@@ -1795,7 +1795,7 @@ setsockopt_pktinfo (int sock)
 /* Read RIP packet by recvmsg function. */
 int
 rip_recvmsg (int sock, u_char *buf, int size, struct sockaddr_in *from,
-            int *ifindex)
+            ifindex_t *ifindex)
 {
   int ret;
   struct msghdr msg;
@@ -1836,7 +1836,7 @@ rip_read_new (struct thread *t)
   int sock;
   char buf[RIP_PACKET_MAXSIZ];
   struct sockaddr_in from;
-  unsigned int ifindex;
+  ifindex_t ifindex;
   
   /* Fetch socket then register myself. */
   sock = THREAD_FD (t);
index fe9e521d881ee471bde92aa2261797853086c300..d01d0b6bbe2945b12cb7330b9d1e829ed77e7631 100644 (file)
@@ -198,7 +198,7 @@ struct rip_info
   struct in_addr from;
 
   /* Which interface does this route come from. */
-  unsigned int ifindex;
+  ifindex_t ifindex;
 
   /* Metric of this route. */
   u_int32_t metric;
@@ -224,7 +224,7 @@ struct rip_info
   u_char metric_set;
   u_int32_t metric_out;
   u_short tag_out;
-  unsigned int ifindex_out;
+  ifindex_t ifindex_out;
 
   struct route_node *rp;
 
@@ -400,9 +400,9 @@ extern int rip_request_send (struct sockaddr_in *, struct interface *, u_char,
 extern int rip_neighbor_lookup (struct sockaddr_in *);
 
 extern int rip_redistribute_check (int);
-extern void rip_redistribute_add (int, int, struct prefix_ipv4 *, unsigned int, 
+extern void rip_redistribute_add (int, int, struct prefix_ipv4 *, ifindex_t,
                           struct in_addr *, unsigned int, unsigned char);
-extern void rip_redistribute_delete (int, int, struct prefix_ipv4 *, unsigned int);
+extern void rip_redistribute_delete (int, int, struct prefix_ipv4 *, ifindex_t);
 extern void rip_redistribute_withdraw (int);
 extern void rip_zebra_ipv4_add (struct route_node *);
 extern void rip_zebra_ipv4_delete (struct route_node *);
index ecfe2d5154f754201e54b257eab3f959c6fba756..d8667cb68ceb3a49c20874c9ef45789ea9f0ec71 100644 (file)
@@ -42,7 +42,7 @@ static void
 ripng_zebra_ipv6_send (struct route_node *rp, u_char cmd)
 {
   static struct in6_addr **nexthops = NULL;
-  static unsigned int *ifindexes = NULL;
+  static ifindex_t *ifindexes = NULL;
   static unsigned int nexthops_len = 0;
 
   struct list *list = (struct list *)rp->info;
index b786c6f938a6e9721654c77bc6464a8c68caf923..2858bb646217777391ef7ffd4c96fd8b4174dbb8 100644 (file)
@@ -229,7 +229,7 @@ ripng_send_packet (caddr_t buf, int bufsize, struct sockaddr_in6 *to,
 /* Receive UDP RIPng packet from socket. */
 static int
 ripng_recv_packet (int sock, u_char *buf, int bufsize,
-                  struct sockaddr_in6 *from, unsigned int *ifindex, 
+                  struct sockaddr_in6 *from, ifindex_t *ifindex,
                   int *hoplimit)
 {
   int ret;
@@ -973,7 +973,7 @@ ripng_route_process (struct rte *rte, struct sockaddr_in6 *from,
 /* Add redistributed route to RIPng table. */
 void
 ripng_redistribute_add (int type, int sub_type, struct prefix_ipv6 *p, 
-                       unsigned int ifindex, struct in6_addr *nexthop)
+                       ifindex_t ifindex, struct in6_addr *nexthop)
 {
   struct route_node *rp;
   struct ripng_info *rinfo = NULL, newinfo;
@@ -1043,7 +1043,7 @@ ripng_redistribute_add (int type, int sub_type, struct prefix_ipv6 *p,
 /* Delete redistributed route to RIPng table. */
 void
 ripng_redistribute_delete (int type, int sub_type, struct prefix_ipv6 *p, 
-                          unsigned int ifindex)
+                          ifindex_t ifindex)
 {
   struct route_node *rp;
   struct ripng_info *rinfo;
@@ -1361,7 +1361,7 @@ ripng_read (struct thread *thread)
   int sock;
   struct sockaddr_in6 from;
   struct ripng_packet *packet;
-  unsigned int ifindex = 0;
+  ifindex_t ifindex = 0;
   struct interface *ifp;
   int hoplimit = -1;
 
index 1496de08bfcaf48dc65a04b9691551173555f47f..b87b927f488b9b3353cda2eb5a4f87993af8b142 100644 (file)
@@ -176,7 +176,7 @@ struct ripng_info
   struct in6_addr from;
 
   /* Which interface does this route come from. */
-  unsigned int ifindex;                
+  ifindex_t ifindex;
 
   /* Metric of this route.  */
   u_char metric;               
@@ -381,9 +381,9 @@ extern void ripng_info_free (struct ripng_info *rinfo);
 extern void ripng_event (enum ripng_event, int);
 extern int ripng_request (struct interface *ifp);
 extern void ripng_redistribute_add (int, int, struct prefix_ipv6 *,
-                                    unsigned int, struct in6_addr *);
+                                    ifindex_t, struct in6_addr *);
 extern void ripng_redistribute_delete (int, int, struct prefix_ipv6 *,
-                                       unsigned int);
+                                       ifindex_t);
 extern void ripng_redistribute_withdraw (int type);
 
 extern void ripng_distribute_update_interface (struct interface *);
index 23224dc241134a61b649e854a6bb923e6223178f..638062d5d651e204b19e572d8a70d91a77010056 100644 (file)
@@ -988,7 +988,7 @@ rtm_read (struct rt_msghdr *rtm)
       if (rtm->rtm_type != RTM_GET && rtm->rtm_pid == pid)
         return;
       struct prefix_ipv6 p;
-      unsigned int ifindex = 0;
+      ifindex_t ifindex = 0;
 
       p.family = AF_INET6;
       p.prefix = dest.sin6.sin6_addr;
index 5e0bce44617fc5c5d01c8b4c8684c8c173510447..291ee0b714ad328302c6ec2ad6960de3a73874aa 100644 (file)
@@ -203,7 +203,7 @@ struct static_route
    * STATIC_IFINDEX uses ifindex
    */
   union g_addr addr;
-  unsigned int ifindex;
+  ifindex_t ifindex;
 
   char ifname[INTERFACE_NAMSIZ + 1];
 
@@ -215,7 +215,6 @@ struct static_route
  */
 };
 
-
 /* The following for loop allows to iterate over the nexthop
  * structure of routes.
  *
@@ -321,14 +320,14 @@ typedef enum
   RIB_UPDATE_OTHER
 } rib_update_event_t;
 
-extern struct nexthop *rib_nexthop_ifindex_add (struct rib *, unsigned int);
+extern struct nexthop *rib_nexthop_ifindex_add (struct rib *, ifindex_t);
 extern struct nexthop *rib_nexthop_blackhole_add (struct rib *);
 extern struct nexthop *rib_nexthop_ipv4_add (struct rib *, struct in_addr *,
                                             struct in_addr *);
 extern struct nexthop *rib_nexthop_ipv4_ifindex_add (struct rib *,
                                                     struct in_addr *,
                                                     struct in_addr *,
-                                                    unsigned int);
+                                                    ifindex_t);
 extern void rib_nexthop_add (struct rib *rib, struct nexthop *nexthop);
 extern void rib_copy_nexthops (struct rib *rib, struct nexthop *nh);
 
@@ -364,7 +363,7 @@ extern int rib_lookup_ipv4_route (struct prefix_ipv4 *, union sockunion *,
 extern struct nexthop *rib_nexthop_ipv6_add (struct rib *, struct in6_addr *);
 extern struct nexthop *rib_nexthop_ipv6_ifindex_add (struct rib *rib,
                                                     struct in6_addr *ipv6,
-                                                    unsigned int ifindex);
+                                                    ifindex_t ifindex);
 
 extern int is_zebra_valid_kernel_table(u_int32_t table_id);
 extern int is_zebra_main_routing_table(u_int32_t table_id);
@@ -375,13 +374,13 @@ extern int zebra_check_addr (struct prefix *p);
  * also implicitly withdraw equal prefix of same type. */
 extern int rib_add_ipv4 (int type, u_short instance, int flags, struct prefix_ipv4 *p,
                         struct in_addr *gate, struct in_addr *src,
-                        unsigned int ifindex, vrf_id_t vrf_id, u_int32_t table_id,
+                        ifindex_t ifindex, vrf_id_t vrf_id, u_int32_t table_id,
                         u_int32_t, u_char, safi_t);
 
 extern int rib_add_ipv4_multipath (struct prefix_ipv4 *, struct rib *, safi_t);
 
 extern int rib_delete_ipv4 (int type, u_short instance, int flags, struct prefix_ipv4 *p,
-                           struct in_addr *gate, unsigned int ifindex, 
+                           struct in_addr *gate, ifindex_t ifindex,
                            vrf_id_t, u_int32_t, safi_t safi);
 
 extern struct rib *rib_match_ipv4 (struct in_addr, safi_t safi, vrf_id_t,
@@ -406,22 +405,22 @@ extern void
 static_uninstall_route (afi_t afi, safi_t safi, struct prefix *p, struct static_route *si);
 
 extern int
-static_add_ipv4 (safi_t safi, struct prefix *p, struct in_addr *gate, unsigned int ifindex,
+static_add_ipv4 (safi_t safi, struct prefix *p, struct in_addr *gate, ifindex_t ifindex,
                  const char *ifname, u_char flags, u_short tag,
                 u_char distance, struct zebra_vrf *zvrf);
 
 extern int
-static_delete_ipv4 (safi_t safi, struct prefix *p, struct in_addr *gate, unsigned int ifindex,
+static_delete_ipv4 (safi_t safi, struct prefix *p, struct in_addr *gate, ifindex_t ifindex,
                    u_short tag, u_char distance, struct zebra_vrf *zvrf);
 
 extern int
 rib_add_ipv6 (int type, u_short instance, int flags, struct prefix_ipv6 *p,
-             struct in6_addr *gate, unsigned int ifindex, vrf_id_t vrf_id,
+             struct in6_addr *gate, ifindex_t ifindex, vrf_id_t vrf_id,
               u_int32_t table_id, u_int32_t metric, u_char distance, safi_t safi);
 
 extern int
 rib_delete_ipv6 (int type, u_short instance, int flags, struct prefix_ipv6 *p,
-                struct in6_addr *gate, unsigned int ifindex, vrf_id_t vrf_id,
+                struct in6_addr *gate, ifindex_t ifindex, vrf_id_t vrf_id,
                  u_int32_t table_id, safi_t safi);
 
 extern struct rib *rib_lookup_ipv6 (struct in6_addr *, vrf_id_t);
@@ -432,16 +431,16 @@ extern struct route_table *rib_table_ipv6;
 
 extern int
 static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate,
-                unsigned int ifindex, const char *ifname, u_char flags,
+                ifindex_t ifindex, const char *ifname, u_char flags,
                 u_short tag, u_char distance, struct zebra_vrf *zvrf);
 
 extern int
 rib_add_ipv6_multipath (struct prefix *, struct rib *, safi_t,
-                        unsigned long);
+                        ifindex_t);
 
 extern int
 static_delete_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate,
-                   unsigned int ifindex, u_short tag, u_char distance,
+                   ifindex_t ifindex, u_short tag, u_char distance,
                     struct zebra_vrf *zvrf);
 
 extern int rib_gc_dest (struct route_node *rn);
index bd1c923506b5427fca2521008010456314909bfd..d93a530317730ba22f8921bfd1d9c086180ff279 100644 (file)
@@ -74,7 +74,7 @@ extern u_int32_t nl_rcvbufsize;
 /* Note: on netlink systems, there should be a 1-to-1 mapping between interface
    names and ifindex values. */
 static void
-set_ifindex(struct interface *ifp, unsigned int ifi_index)
+set_ifindex(struct interface *ifp, ifindex_t ifi_index)
 {
   struct interface *oifp;
   struct zebra_ns *zns = zebra_ns_lookup (NS_DEFAULT);
index ffb0d088a71c479cc5b5d416f87587dd6c1e71c8..24671829f03871303fc3bf49535d97fdaf387964 100644 (file)
@@ -76,7 +76,7 @@ kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib, int family)
   struct nexthop *nexthop, *tnexthop;
   int recursing;
   int nexthop_num = 0;
-  unsigned int ifindex = 0;
+  ifindex_t ifindex = 0;
   int gate = 0;
   int error;
   char prefix_buf[PREFIX_STRLEN];
@@ -287,7 +287,7 @@ kernel_rtm_ipv6_multipath (int cmd, struct prefix *p, struct rib *rib,
   struct nexthop *nexthop, *tnexthop;
   int recursing;
   int nexthop_num = 0;
-  unsigned int ifindex = 0;
+  ifindex_t ifindex = 0;
   int gate = 0;
   int error;
 
index f3f1cee14b328d08209ecec9fafa4bf0bfb7e3a0..8333d2e08c97928a1869d16613934d293091e335 100644 (file)
@@ -70,7 +70,7 @@ static int if_join_all_router (int, struct interface *);
 static int if_leave_all_router (int, struct interface *);
 
 static int
-rtadv_increment_received(struct zebra_ns *zns, unsigned int *ifindex)
+rtadv_increment_received(struct zebra_ns *zns, ifindex_t *ifindex)
 {
   int ret = -1;
   struct interface *iface;
@@ -88,7 +88,7 @@ rtadv_increment_received(struct zebra_ns *zns, unsigned int *ifindex)
 
 static int
 rtadv_recv_packet (struct zebra_ns *zns, int sock, u_char *buf, int buflen,
-                  struct sockaddr_in6 *from, unsigned int *ifindex,
+                  struct sockaddr_in6 *from, ifindex_t *ifindex,
                   int *hoplimit)
 {
   int ret;
@@ -534,7 +534,7 @@ rtadv_process_advert (u_char *msg, unsigned int len, struct interface *ifp,
 
 
 static void
-rtadv_process_packet (u_char *buf, unsigned int len, unsigned int ifindex, int hoplimit,
+rtadv_process_packet (u_char *buf, unsigned int len, ifindex_t ifindex, int hoplimit,
                       struct sockaddr_in6 *from, struct zebra_ns *zns)
 {
   struct icmp6_hdr *icmph;
@@ -609,7 +609,7 @@ rtadv_read (struct thread *thread)
   int len;
   u_char buf[RTADV_MSG_SIZE];
   struct sockaddr_in6 from;
-  unsigned int ifindex = 0;
+  ifindex_t ifindex = 0;
   int hoplimit = -1;
   struct zebra_ns *zns = THREAD_ARG (thread);
 
index 902c675aef510f18b9239fe1edfa744a82322335..95c56bb0464c0a29fa427ce12d31c8f7bdac8bbb 100644 (file)
@@ -112,7 +112,7 @@ usage (char *progname, int status)
   exit (status);
 }
 
-static unsigned int test_ifindex = 0;
+static ifindex_t test_ifindex = 0;
 
 /* testrib commands */
 DEFUN (test_interface_state,
index 3aa9356fe653469207130ec01c62ef654465f385..16f43f7312ad908ad926acc50ee735120f1eb178 100644 (file)
 
 #include <zebra.h>
 
+#include "if.h"
 #include "prefix.h"
 #include "table.h"
 #include "memory.h"
 #include "str.h"
 #include "command.h"
-#include "if.h"
 #include "log.h"
 #include "sockunion.h"
 #include "linklist.h"
@@ -210,7 +210,7 @@ rib_nexthop_delete (struct rib *rib, struct nexthop *nexthop)
 
 
 struct nexthop *
-rib_nexthop_ifindex_add (struct rib *rib, unsigned int ifindex)
+rib_nexthop_ifindex_add (struct rib *rib, ifindex_t ifindex)
 {
   struct nexthop *nexthop;
 
@@ -241,7 +241,7 @@ rib_nexthop_ipv4_add (struct rib *rib, struct in_addr *ipv4, struct in_addr *src
 
 struct nexthop *
 rib_nexthop_ipv4_ifindex_add (struct rib *rib, struct in_addr *ipv4,
-                             struct in_addr *src, unsigned int ifindex)
+                             struct in_addr *src, ifindex_t ifindex)
 {
   struct nexthop *nexthop;
   struct interface *ifp;
@@ -281,7 +281,7 @@ rib_nexthop_ipv6_add (struct rib *rib, struct in6_addr *ipv6)
 
 struct nexthop *
 rib_nexthop_ipv6_ifindex_add (struct rib *rib, struct in6_addr *ipv6,
-                             unsigned int ifindex)
+                             ifindex_t ifindex)
 {
   struct nexthop *nexthop;
 
@@ -1199,8 +1199,8 @@ nexthop_active_update (struct route_node *rn, struct rib *rib, int set)
 {
   struct nexthop *nexthop;
   union g_addr prev_src;
-  unsigned int prev_active, prev_index, new_active, old_num_nh;
-
+  unsigned int prev_active, new_active, old_num_nh;
+  ifindex_t prev_index;
   old_num_nh = rib->nexthop_active_num;
 
   rib->nexthop_active_num = 0;
@@ -2413,7 +2413,7 @@ rib_delnode (struct route_node *rn, struct rib *rib)
 int
 rib_add_ipv4 (int type, u_short instance, int flags, struct prefix_ipv4 *p,
              struct in_addr *gate, struct in_addr *src,
-             unsigned int ifindex, vrf_id_t vrf_id, u_int32_t table_id,
+             ifindex_t ifindex, vrf_id_t vrf_id, u_int32_t table_id,
              u_int32_t metric, u_char distance, safi_t safi)
 {
   struct rib *rib;
@@ -2770,7 +2770,7 @@ rib_add_ipv4_multipath (struct prefix_ipv4 *p, struct rib *rib, safi_t safi)
 /* XXX factor with rib_delete_ipv6 */
 int
 rib_delete_ipv4 (int type, u_short instance, int flags, struct prefix_ipv4 *p,
-                struct in_addr *gate, unsigned int ifindex, vrf_id_t vrf_id,
+                struct in_addr *gate, ifindex_t ifindex, vrf_id_t vrf_id,
                 u_int32_t table_id, safi_t safi)
 {
   struct route_table *table;
@@ -3182,7 +3182,7 @@ static_uninstall_route (afi_t afi, safi_t safi, struct prefix *p, struct static_
 }
 
 int
-static_add_ipv4 (safi_t safi, struct prefix *p, struct in_addr *gate, unsigned int ifindex,
+static_add_ipv4 (safi_t safi, struct prefix *p, struct in_addr *gate, ifindex_t ifindex,
                 const char *ifname, u_char flags, u_short tag,
                 u_char distance, struct zebra_vrf *zvrf)
 {
@@ -3278,7 +3278,7 @@ static_add_ipv4 (safi_t safi, struct prefix *p, struct in_addr *gate, unsigned i
 }
 
 int
-static_delete_ipv4 (safi_t safi, struct prefix *p, struct in_addr *gate, unsigned int ifindex,
+static_delete_ipv4 (safi_t safi, struct prefix *p, struct in_addr *gate, ifindex_t ifindex,
                    u_short tag, u_char distance, struct zebra_vrf *zvrf)
 {
   u_char type = 0;
@@ -3341,7 +3341,7 @@ static_delete_ipv4 (safi_t safi, struct prefix *p, struct in_addr *gate, unsigne
 
 int
 rib_add_ipv6 (int type, u_short instance, int flags, struct prefix_ipv6 *p,
-             struct in6_addr *gate, unsigned int ifindex, vrf_id_t vrf_id,
+             struct in6_addr *gate, ifindex_t ifindex, vrf_id_t vrf_id,
               u_int32_t table_id, u_int32_t metric, u_char distance, safi_t safi)
 {
   struct rib *rib;
@@ -3450,7 +3450,7 @@ rib_add_ipv6 (int type, u_short instance, int flags, struct prefix_ipv6 *p,
 
 int
 rib_add_ipv6_multipath (struct prefix *p, struct rib *rib, safi_t safi,
-                       unsigned long ifindex)
+                       ifindex_t ifindex)
 {
   struct route_table *table;
   struct route_node *rn;
@@ -3565,7 +3565,7 @@ rib_add_ipv6_multipath (struct prefix *p, struct rib *rib, safi_t safi,
 
 int
 rib_delete_ipv6 (int type, u_short instance, int flags, struct prefix_ipv6 *p,
-                struct in6_addr *gate, unsigned int ifindex, vrf_id_t vrf_id,
+                struct in6_addr *gate, ifindex_t ifindex, vrf_id_t vrf_id,
                  u_int32_t table_id, safi_t safi)
 {
   struct route_table *table;
@@ -3702,7 +3702,7 @@ rib_delete_ipv6 (int type, u_short instance, int flags, struct prefix_ipv6 *p,
 /* Add static route into static route configuration. */
 int
 static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate,
-                unsigned int ifindex, const char *ifname, u_char flags,
+                ifindex_t ifindex, const char *ifname, u_char flags,
                 u_short tag, u_char distance, struct zebra_vrf *zvrf)
 {
   struct route_node *rn;
@@ -3798,7 +3798,7 @@ static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate,
 /* Delete static route from static route configuration. */
 int
 static_delete_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate,
-                   unsigned int ifindex, u_short tag, u_char distance,
+                   ifindex_t ifindex, u_short tag, u_char distance,
                     struct zebra_vrf *zvrf)
 {
   struct route_node *rn;
index db3e5eaba103ae5c9738d413379e9102b32f0c14..1417824d0729eebdb55e40e2c60b6c7588d58c8f 100644 (file)
@@ -252,7 +252,7 @@ route_match_interface (void *rule, struct prefix *prefix,
 {
   struct nh_rmap_obj *nh_data;
   char *ifname = rule;
-  unsigned int ifindex;
+  ifindex_t ifindex;
 
   if (type == RMAP_ZEBRA)
     {
index d625c02ff475f4db646dfa3fb5a31eace9fb3ec8..a1fe9bc188d8eab602703fdcfd0eae7e6a5a6591 100644 (file)
@@ -1188,7 +1188,7 @@ zread_ipv4_add (struct zserv *client, u_short length, struct zebra_vrf *zvrf)
   u_char nexthop_num;
   u_char nexthop_type;
   struct stream *s;
-  unsigned int ifindex;
+  ifindex_t ifindex;
   safi_t safi;
   int ret;