*: use an ifindex_t type, defined in lib/if.h, for ifindex values
diff --git a/bgpd/bgp_btoa.c b/bgpd/bgp_btoa.c
index 284b280..b408efd 100644
--- a/bgpd/bgp_btoa.c
+++ b/bgpd/bgp_btoa.c
@@ -144,7 +144,7 @@
size_t len;
int source_as;
int dest_as;
- int ifindex;
+ ifindex_t ifindex;
int family;
struct in_addr sip;
struct in_addr dip;
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index 7a22713..51a6f60 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -365,7 +365,7 @@
int
bgp_connect (struct peer *peer)
{
- unsigned int ifindex = 0;
+ ifindex_t ifindex = 0;
/* Make socket for the peer. */
peer->fd = sockunion_socket (&peer->su);
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index af312e3..4ec15d0 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -757,7 +757,7 @@
/* We have to think about a IPv6 link-local address curse. */
if (p->family == AF_INET6)
{
- unsigned int ifindex;
+ ifindex_t ifindex;
struct in6_addr *nexthop;
struct zapi_ipv6 api;
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 455034f..5be5a19 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -340,7 +340,7 @@
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 *ifname; /* bind interface name. */
char *update_if;
union sockunion *update_source;
diff --git a/isisd/isis_route.c b/isisd/isis_route.c
index 0348a79..9cca809 100644
--- a/isisd/isis_route.c
+++ b/isisd/isis_route.c
@@ -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 @@
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 @@
#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 @@
}
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 @@
static int
nexthop6lookup (struct list *nexthops6, struct in6_addr *ip6,
- unsigned int ifindex)
+ ifindex_t ifindex)
{
struct listnode *node;
struct isis_nexthop6 *nh6;
diff --git a/isisd/isis_route.h b/isisd/isis_route.h
index 5adea22..0d2379c 100644
--- a/isisd/isis_route.h
+++ b/isisd/isis_route.h
@@ -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_nexthop
{
- unsigned int ifindex;
+ ifindex_t ifindex;
struct in_addr ip;
struct in_addr router_address;
unsigned int lock;
diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c
index 8c4eef0..6c398cf 100644
--- a/isisd/isis_zebra.c
+++ b/isisd/isis_zebra.c
@@ -329,7 +329,7 @@
{
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;
@@ -365,7 +365,7 @@
/* 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!");
@@ -415,7 +415,7 @@
{
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;
@@ -445,7 +445,7 @@
/* 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!");
diff --git a/lib/if.c b/lib/if.c
index 3426212..44b8586 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -189,41 +189,41 @@
/* 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;
@@ -232,7 +232,7 @@
: IFINDEX_INTERNAL;
}
-unsigned int
+ifindex_t
ifname2ifindex (const char *name)
{
return ifname2ifindex_vrf (name, VRF_DEFAULT);
@@ -928,7 +928,7 @@
}
#ifndef HAVE_IF_NAMETOINDEX
-unsigned int
+ifindex_t
if_nametoindex (const char *name)
{
struct interface *ifp;
@@ -940,7 +940,7 @@
#ifndef HAVE_IF_INDEXTONAME
char *
-if_indextoname (unsigned int ifindex, char *name)
+if_indextoname (ifindex_t ifindex, char *name)
{
struct interface *ifp;
@@ -1005,7 +1005,7 @@
/* 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;
diff --git a/lib/if.h b/lib/if.h
index 0cb2202..b3d14ba 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -21,6 +21,7 @@
#ifndef _ZEBRA_IF_H
#define _ZEBRA_IF_H
+#include "zebra.h"
#include "linklist.h"
/* Interface link-layer type, if known. Derived from:
@@ -96,6 +97,8 @@
#define INTERFACE_NAMSIZ 20
#define INTERFACE_HWADDR_MAX 20
+typedef signed int ifindex_t;
+
#ifdef HAVE_PROC_NET_DEV
struct if_stats
{
@@ -142,7 +145,7 @@
/* Interface index (should be IFINDEX_INTERNAL for non-kernel or
deleted interfaces). */
- unsigned int ifindex;
+ ifindex_t ifindex;
#define IFINDEX_INTERNAL 0
/* Zebra internal interface status */
@@ -294,15 +297,14 @@
/* Prototypes. */
extern int if_cmp_func (struct interface *, struct interface *);
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 (struct in_addr);
extern struct interface *if_lookup_address (struct in_addr);
extern struct interface *if_lookup_prefix (struct prefix *prefix);
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 (struct in_addr,
vrf_id_t vrf_id);
extern struct interface *if_lookup_address_vrf (struct in_addr,
@@ -359,14 +361,14 @@
/* 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);
@@ -381,10 +383,10 @@
struct in_addr);
#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. */
diff --git a/lib/sockopt.c b/lib/sockopt.c
index 257271b..3014237 100644
--- a/lib/sockopt.c
+++ b/lib/sockopt.c
@@ -220,7 +220,7 @@
setsockopt_ipv4_multicast(int sock,
int optname,
unsigned int mcast_addr,
- unsigned int ifindex)
+ ifindex_t ifindex)
{
#ifdef HAVE_RFC3678
struct group_req gr;
@@ -318,8 +318,7 @@
* Set IP_MULTICAST_IF socket option in an OS-dependent manner.
*/
int
-setsockopt_ipv4_multicast_if(int sock,
- unsigned int ifindex)
+setsockopt_ipv4_multicast_if(int sock, ifindex_t ifindex)
{
#ifdef HAVE_STRUCT_IP_MREQN_IMR_IFINDEX
@@ -345,7 +344,7 @@
}
static int
-setsockopt_ipv4_ifindex (int sock, int val)
+setsockopt_ipv4_ifindex (int sock, ifindex_t val)
{
int ret;
@@ -381,7 +380,7 @@
int
-setsockopt_ifindex (int af, int sock, int val)
+setsockopt_ifindex (int af, int sock, ifindex_t val)
{
int ret = -1;
@@ -408,11 +407,11 @@
* 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 */
@@ -432,7 +431,7 @@
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
@@ -473,7 +472,7 @@
}
/* return ifindex, 0 if none found */
-int
+ifindex_t
getsockopt_ifindex (int af, struct msghdr *msgh)
{
switch (af)
diff --git a/lib/sockopt.h b/lib/sockopt.h
index cb14efc..a9b8aca 100644
--- a/lib/sockopt.h
+++ b/lib/sockopt.h
@@ -83,16 +83,15 @@
(((af) == AF_INET) : SOPT_SIZE_CMSG_IFINDEX_IPV4() \
? SOPT_SIZE_CMSG_PKTINFO_IPV6())
-extern int setsockopt_ipv4_multicast_if(int sock,
- unsigned int ifindex);
+extern int setsockopt_ipv4_multicast_if(int sock, ifindex_t ifindex);
extern int setsockopt_ipv4_multicast(int sock, int optname,
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.
diff --git a/lib/sockunion.c b/lib/sockunion.c
index 492c36e..4a22c63 100644
--- a/lib/sockunion.c
+++ b/lib/sockunion.c
@@ -291,7 +291,7 @@
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;
diff --git a/lib/sockunion.h b/lib/sockunion.h
index a6f964f..b91c571 100644
--- a/lib/sockunion.h
+++ b/lib/sockunion.h
@@ -23,6 +23,8 @@
#ifndef _ZEBRA_SOCKUNION_H
#define _ZEBRA_SOCKUNION_H
+#include "if.h"
+
#if 0
union sockunion {
struct sockinet {
@@ -109,7 +111,7 @@
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 *);
diff --git a/lib/zclient.c b/lib/zclient.c
index bd93d06..9188c01 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -811,7 +811,7 @@
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;
diff --git a/lib/zclient.h b/lib/zclient.h
index a14f599..d069eb2 100644
--- a/lib/zclient.h
+++ b/lib/zclient.h
@@ -126,7 +126,7 @@
struct in_addr **nexthop;
u_char ifindex_num;
- unsigned int *ifindex;
+ ifindex_t *ifindex;
u_char distance;
@@ -201,7 +201,7 @@
struct in6_addr **nexthop;
u_char ifindex_num;
- unsigned int *ifindex;
+ ifindex_t *ifindex;
u_char distance;
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index b1620d4..6eca142 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -411,7 +411,7 @@
}
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;
@@ -557,7 +557,8 @@
}
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;
diff --git a/ospf6d/ospf6_asbr.h b/ospf6d/ospf6_asbr.h
index 73770cc..f3df90b 100644
--- a/ospf6d/ospf6_asbr.h
+++ b/ospf6d/ospf6_asbr.h
@@ -49,7 +49,7 @@
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_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);
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index c9c9011..26f68ac 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -59,7 +59,7 @@
};
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;
diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c
index e71b410..d382f03 100644
--- a/ospf6d/ospf6_message.c
+++ b/ospf6d/ospf6_message.c
@@ -1515,7 +1515,7 @@
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;
diff --git a/ospf6d/ospf6_neighbor.h b/ospf6d/ospf6_neighbor.h
index 93ffa28..54b7ffe 100644
--- a/ospf6d/ospf6_neighbor.h
+++ b/ospf6d/ospf6_neighbor.h
@@ -53,7 +53,7 @@
u_int32_t router_id;
/* Neighbor Interface ID */
- u_int32_t ifindex;
+ ifindex_t ifindex;
/* Router Priority of this neighbor */
u_char priority;
diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c
index e0be38b..a773750 100644
--- a/ospf6d/ospf6_network.c
+++ b/ospf6d/ospf6_network.c
@@ -113,7 +113,7 @@
/* ospf6 set socket option */
void
-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;
@@ -150,7 +150,7 @@
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;
@@ -208,7 +208,7 @@
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;
diff --git a/ospf6d/ospf6_network.h b/ospf6d/ospf6_network.h
index 127bf45..f4b74fa 100644
--- a/ospf6d/ospf6_network.h
+++ b/ospf6d/ospf6_network.h
@@ -29,12 +29,12 @@
extern struct in6_addr alldrouters6;
extern int ospf6_serv_sock (void);
-extern void ospf6_sso (u_int ifindex, struct in6_addr *group, int option);
+extern void 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 */
diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h
index 42eb69e..2fb2c1d 100644
--- a/ospf6d/ospf6_route.h
+++ b/ospf6d/ospf6_route.h
@@ -41,7 +41,7 @@
struct ospf6_nexthop
{
/* Interface index */
- unsigned int ifindex;
+ ifindex_t ifindex;
/* IP address, if any */
struct in6_addr address;
diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c
index 307d420..266031e 100644
--- a/ospf6d/ospf6_snmp.c
+++ b/ospf6d/ospf6_snmp.c
@@ -623,7 +623,7 @@
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;
@@ -835,7 +835,8 @@
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;
@@ -849,8 +850,6 @@
== MATCH_FAILED)
return NULL;
- ifindex = instid = 0;
-
/* Check OSPFv3 instance. */
if (ospf6 == NULL)
return NULL;
@@ -988,7 +987,8 @@
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;
@@ -1001,7 +1001,7 @@
== MATCH_FAILED)
return NULL;
- ifindex = instid = rtrid = 0;
+ instid = rtrid = 0;
/* Check OSPFv3 instance. */
if (ospf6 == NULL)
diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c
index 88e1285..858398e 100644
--- a/ospf6d/ospf6_spf.c
+++ b/ospf6d/ospf6_spf.c
@@ -225,7 +225,8 @@
ospf6_nexthop_calc (struct ospf6_vertex *w, struct ospf6_vertex *v,
caddr_t lsdesc)
{
- int i, ifindex;
+ int i;
+ ifindex_t ifindex;
struct ospf6_interface *oi;
u_int16_t type;
u_int32_t adv_router;
@@ -235,7 +236,10 @@
assert (VERTEX_IS_TYPE (ROUTER, w));
ifindex = (VERTEX_IS_TYPE (NETWORK, v) ? v->nexthop[0].ifindex :
- ROUTER_LSDESC_GET_IFID (lsdesc));
+ /* v is the local router & the interface_id is a local ifindex */
+ (ifindex_t) ROUTER_LSDESC_GET_IFID (lsdesc));
+ assert (ifindex >= 0);
+
oi = ospf6_interface_lookup_by_ifindex (ifindex);
if (oi == NULL)
{
diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c
index d37e508..30b6fc6 100644
--- a/ospf6d/ospf6_zebra.c
+++ b/ospf6d/ospf6_zebra.c
@@ -368,7 +368,7 @@
char buf[64];
int nhcount;
struct in6_addr **nexthops;
- unsigned int *ifindexes;
+ ifindex_t *ifindexes;
int i, ret = 0;
struct prefix_ipv6 *dest;
diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c
index 8bef175..122e70b 100644
--- a/ospfd/ospf_asbr.c
+++ b/ospfd/ospf_asbr.c
@@ -135,7 +135,7 @@
/* Add an External info for AS-external-LSA. */
struct external_info *
ospf_external_info_add (u_char type, struct prefix_ipv4 p,
- unsigned int ifindex, struct in_addr nexthop)
+ ifindex_t ifindex, struct in_addr nexthop)
{
struct external_info *new;
struct route_node *rn;
diff --git a/ospfd/ospf_asbr.h b/ospfd/ospf_asbr.h
index 724acf4..d151cb1 100644
--- a/ospfd/ospf_asbr.h
+++ b/ospfd/ospf_asbr.h
@@ -39,7 +39,7 @@
struct prefix_ipv4 p;
/* Interface index. */
- unsigned int ifindex;
+ ifindex_t ifindex;
/* Nexthop address. */
struct in_addr nexthop;
@@ -61,7 +61,7 @@
struct route_map_set_values *);
extern struct external_info *ospf_external_info_add (u_char,
struct prefix_ipv4,
- unsigned int,
+ ifindex_t,
struct in_addr);
extern void ospf_external_info_delete (u_char, struct prefix_ipv4);
extern struct external_info *ospf_external_info_lookup (u_char,
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index e62a4e7..6bd8c3e 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -2206,7 +2206,7 @@
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;
diff --git a/ospfd/ospf_lsa.h b/ospfd/ospf_lsa.h
index dd3b91a..c940724 100644
--- a/ospfd/ospf_lsa.h
+++ b/ospfd/ospf_lsa.h
@@ -283,7 +283,7 @@
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 *);
diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c
index 900a566..02ddf92 100644
--- a/ospfd/ospf_network.c
+++ b/ospfd/ospf_network.c
@@ -48,7 +48,7 @@
/* 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 @@
int
ospf_if_drop_allspfrouters (struct ospf *top, struct prefix *p,
- unsigned int ifindex)
+ ifindex_t ifindex)
{
int ret;
@@ -89,8 +89,7 @@
/* 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 @@
}
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 @@
}
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;
diff --git a/ospfd/ospf_network.h b/ospfd/ospf_network.h
index e0a5c69..8257adb 100644
--- a/ospfd/ospf_network.h
+++ b/ospfd/ospf_network.h
@@ -25,14 +25,14 @@
/* 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);
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 9a8f1d6..117401c 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -2125,7 +2125,7 @@
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())];
diff --git a/ospfd/ospf_route.h b/ospfd/ospf_route.h
index 6c202b0..d509e4a 100644
--- a/ospfd/ospf_route.h
+++ b/ospfd/ospf_route.h
@@ -39,7 +39,7 @@
{
struct in_addr nexthop;
struct in_addr adv_router;
- unsigned int ifindex;
+ ifindex_t ifindex;
};
/* Below is the structure linked to every
diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c
index 1636153..ebeffa8 100644
--- a/ospfd/ospf_snmp.c
+++ b/ospfd/ospf_snmp.c
@@ -1413,7 +1413,7 @@
struct ospf_snmp_if
{
struct in_addr addr;
- unsigned int ifindex;
+ ifindex_t ifindex;
struct interface *ifp;
};
@@ -1455,7 +1455,7 @@
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 @@
}
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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;
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index 930dad0..2533d0f 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -759,7 +759,7 @@
/*
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)
{
return ifindex;
}
@@ -910,7 +910,7 @@
}
static int igmp_join_sock(const char *ifname,
- int ifindex,
+ ifindex_t ifindex,
struct in_addr group_addr,
struct in_addr source_addr)
{
diff --git a/pimd/pim_iface.h b/pimd/pim_iface.h
index 8806fdd..8cad3d1 100644
--- a/pimd/pim_iface.h
+++ b/pimd/pim_iface.h
@@ -122,8 +122,8 @@
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);
diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c
index 4fd3edc..7baf2e3 100644
--- a/pimd/pim_igmp.c
+++ b/pimd/pim_igmp.c
@@ -47,7 +47,8 @@
static struct igmp_group *find_group_by_addr(struct igmp_sock *igmp,
struct in_addr group_addr);
-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;
@@ -952,7 +953,7 @@
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);
diff --git a/pimd/pim_igmp_join.c b/pimd/pim_igmp_join.c
index 62e32c6..042818a 100644
--- a/pimd/pim_igmp_join.c
+++ b/pimd/pim_igmp_join.c
@@ -26,6 +26,7 @@
#include <sys/socket.h>
#include <string.h>
+#include "zebra.h"
#include "pim_igmp_join.h"
#ifndef SOL_IP
@@ -42,7 +43,7 @@
};
#endif
-int pim_igmp_join_source(int fd, int ifindex,
+int pim_igmp_join_source(int fd, ifindex_t ifindex,
struct in_addr group_addr,
struct in_addr source_addr)
{
diff --git a/pimd/pim_igmp_join.h b/pimd/pim_igmp_join.h
index 1127af1..67779ff 100644
--- a/pimd/pim_igmp_join.h
+++ b/pimd/pim_igmp_join.h
@@ -24,8 +24,9 @@
#define PIM_IGMP_JOIN_H
#include <netinet/in.h>
+#include "if.h"
-int pim_igmp_join_source(int fd, int ifindex,
+int pim_igmp_join_source(int fd, ifindex_t ifindex,
struct in_addr group_addr,
struct in_addr source_addr);
diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c
index a04a0af..c522475 100644
--- a/pimd/pim_pim.c
+++ b/pimd/pim_pim.c
@@ -269,7 +269,7 @@
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);
@@ -376,7 +376,7 @@
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;
diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c
index 2bb48f7..ceae4f2 100644
--- a/pimd/pim_sock.c
+++ b/pimd/pim_sock.c
@@ -180,7 +180,7 @@
}
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;
@@ -228,7 +228,7 @@
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)
@@ -252,7 +252,7 @@
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;
diff --git a/pimd/pim_sock.h b/pimd/pim_sock.h
index cfe39ad..622fb47 100644
--- a/pimd/pim_sock.h
+++ b/pimd/pim_sock.h
@@ -40,15 +40,15 @@
int pim_socket_raw(int protocol);
int pim_socket_mcast(int protocol, struct in_addr ifaddr, 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);
diff --git a/pimd/pim_ssmpingd.c b/pimd/pim_ssmpingd.c
index d564bf5..fe88eba 100644
--- a/pimd/pim_ssmpingd.c
+++ b/pimd/pim_ssmpingd.c
@@ -250,7 +250,7 @@
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;
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c
index 3c739d2..8f85b17 100644
--- a/pimd/pim_zebra.c
+++ b/pimd/pim_zebra.c
@@ -524,7 +524,7 @@
{
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;
@@ -604,7 +604,7 @@
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])),
@@ -621,7 +621,7 @@
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])),
@@ -737,7 +737,7 @@
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,
diff --git a/pimd/pim_zlookup.h b/pimd/pim_zlookup.h
index 1f18494..f2be6d4 100644
--- a/pimd/pim_zlookup.h
+++ b/pimd/pim_zlookup.h
@@ -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;
};
diff --git a/pimd/test_igmpv3_join.c b/pimd/test_igmpv3_join.c
index fe64fbc..81026ae 100644
--- a/pimd/test_igmpv3_join.c
+++ b/pimd/test_igmpv3_join.c
@@ -37,7 +37,7 @@
static int iface_solve_index(const char *ifname)
{
struct if_nameindex *ini;
- int ifindex = -1;
+ ifindex_t ifindex = -1;
int i;
if (!ifname)
@@ -77,7 +77,7 @@
const char *ifname;
const char *group;
const char *source;
- int ifindex;
+ ifindex_t ifindex;
int result;
int fd;
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index 00612df..7bdcf46 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -74,7 +74,7 @@
ipv4_multicast_join (int sock,
struct in_addr group,
struct in_addr ifa,
- unsigned int ifindex)
+ ifindex_t ifindex)
{
int ret;
@@ -95,7 +95,7 @@
ipv4_multicast_leave (int sock,
struct in_addr group,
struct in_addr ifa,
- unsigned int ifindex)
+ ifindex_t ifindex)
{
int ret;
diff --git a/ripd/ripd.c b/ripd/ripd.c
index 870873d..82b1ada 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -1577,7 +1577,7 @@
/* 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;
@@ -1651,7 +1651,7 @@
/* 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;
@@ -1793,7 +1793,7 @@
/* 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;
@@ -1834,7 +1834,7 @@
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);
diff --git a/ripd/ripd.h b/ripd/ripd.h
index a768ccc..dbed342 100644
--- a/ripd/ripd.h
+++ b/ripd/ripd.h
@@ -198,7 +198,7 @@
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 @@
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_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 *);
diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c
index 13b1853..a48539e 100644
--- a/ripngd/ripng_zebra.c
+++ b/ripngd/ripng_zebra.c
@@ -42,7 +42,7 @@
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;
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index 97a1392..d27d45b 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -229,7 +229,7 @@
/* 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;
@@ -971,7 +971,7 @@
/* 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;
@@ -1041,7 +1041,7 @@
/* 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;
@@ -1359,7 +1359,7 @@
int sock;
struct sockaddr_in6 from;
struct ripng_packet *packet;
- unsigned int ifindex = 0;
+ ifindex_t ifindex = 0;
struct interface *ifp;
int hoplimit = -1;
diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h
index 6cbbd84..75b542e 100644
--- a/ripngd/ripngd.h
+++ b/ripngd/ripngd.h
@@ -176,7 +176,7 @@
struct in6_addr from;
/* Which interface does this route come from. */
- unsigned int ifindex;
+ ifindex_t ifindex;
/* Metric of this route. */
u_char metric;
@@ -384,9 +384,9 @@
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 *);
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index 10cc48c..5e68c56 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -1020,7 +1020,7 @@
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;
diff --git a/zebra/rib.h b/zebra/rib.h
index 67ffe8d..1dacc7f 100644
--- a/zebra/rib.h
+++ b/zebra/rib.h
@@ -228,7 +228,7 @@
/* Interface index. */
char *ifname;
- unsigned int ifindex;
+ ifindex_t ifindex;
enum nexthop_types_t type;
@@ -425,7 +425,7 @@
extern enum multicast_mode multicast_mode_ipv4_get (void);
extern const char *nexthop_type_to_str (enum nexthop_types_t nh_type);
-extern struct nexthop *nexthop_ifindex_add (struct rib *, unsigned int);
+extern struct nexthop *nexthop_ifindex_add (struct rib *, ifindex_t);
extern struct nexthop *nexthop_ifname_add (struct rib *, char *);
extern struct nexthop *nexthop_blackhole_add (struct rib *);
extern struct nexthop *nexthop_ipv4_add (struct rib *, struct in_addr *,
@@ -433,7 +433,7 @@
extern struct nexthop *nexthop_ipv4_ifindex_add (struct rib *,
struct in_addr *,
struct in_addr *,
- unsigned int);
+ ifindex_t);
extern int nexthop_has_fib_child(struct nexthop *);
extern void rib_lookup_and_dump (struct prefix_ipv4 *);
extern void rib_lookup_and_pushup (struct prefix_ipv4 *);
@@ -459,13 +459,13 @@
* also implicitly withdraw equal prefix of same type. */
extern int rib_add_ipv4 (int type, int flags, struct prefix_ipv4 *p,
struct in_addr *gate, struct in_addr *src,
- unsigned int ifindex, vrf_id_t vrf_id, int table_id,
+ ifindex_t ifindex, vrf_id_t vrf_id, int table_id,
u_int32_t, 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, int flags, struct prefix_ipv4 *p,
- struct in_addr *gate, unsigned int ifindex,
+ struct in_addr *gate, ifindex_t ifindex,
vrf_id_t, safi_t safi);
extern struct rib *rib_match_ipv4_safi (struct in_addr addr, safi_t safi,
@@ -495,13 +495,13 @@
extern int
rib_add_ipv6 (int type, 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,
int table_id, u_int32_t metric, u_int32_t mtu,
u_char distance, safi_t safi);
extern int
rib_delete_ipv6 (int type, int flags, struct prefix_ipv6 *p,
- struct in6_addr *gate, unsigned int ifindex, vrf_id_t vrf_id, safi_t safi);
+ struct in6_addr *gate, ifindex_t ifindex, vrf_id_t vrf_id, safi_t safi);
extern struct rib *rib_lookup_ipv6 (struct in6_addr *, vrf_id_t);
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index b164c7a..2539d61 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -69,7 +69,7 @@
/* 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;
diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c
index 4d0a7db..78ec9e5 100644
--- a/zebra/rt_socket.c
+++ b/zebra/rt_socket.c
@@ -76,7 +76,7 @@
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];
@@ -252,7 +252,7 @@
struct nexthop *nexthop, *tnexthop;
int recursing;
int nexthop_num = 0;
- unsigned int ifindex = 0;
+ ifindex_t ifindex = 0;
int gate = 0;
int error;
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 7bb9305..9450f9a 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -70,7 +70,7 @@
static int
rtadv_recv_packet (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;
@@ -408,7 +408,7 @@
}
static void
-rtadv_process_packet (u_char *buf, unsigned int len, unsigned int ifindex,
+rtadv_process_packet (u_char *buf, unsigned int len, ifindex_t ifindex,
int hoplimit, vrf_id_t vrf_id)
{
struct icmp6_hdr *icmph;
@@ -472,7 +472,7 @@
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_vrf *zvrf = THREAD_ARG (thread);
diff --git a/zebra/test_main.c b/zebra/test_main.c
index 448d1ef..09f53ad 100644
--- a/zebra/test_main.c
+++ b/zebra/test_main.c
@@ -105,7 +105,7 @@
exit (status);
}
-static unsigned int test_ifindex = 0;
+static ifindex_t test_ifindex = 0;
/* testrib commands */
DEFUN (test_interface_state,
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index d06382c..1650dab 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -198,7 +198,7 @@
}
struct nexthop *
-nexthop_ifindex_add (struct rib *rib, unsigned int ifindex)
+nexthop_ifindex_add (struct rib *rib, ifindex_t ifindex)
{
struct nexthop *nexthop;
@@ -243,7 +243,7 @@
struct nexthop *
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;
@@ -291,7 +291,7 @@
static struct nexthop *
nexthop_ipv6_ifindex_add (struct rib *rib, struct in6_addr *ipv6,
- unsigned int ifindex)
+ ifindex_t ifindex)
{
struct nexthop *nexthop;
@@ -1074,8 +1074,9 @@
nexthop_active_update (struct route_node *rn, struct rib *rib, int set)
{
struct nexthop *nexthop;
- unsigned int prev_active, prev_index, new_active;
-
+ unsigned int prev_active, new_active;
+ ifindex_t prev_index;
+
rib->nexthop_active_num = 0;
UNSET_FLAG (rib->status, RIB_ENTRY_CHANGED);
@@ -1736,7 +1737,7 @@
int
rib_add_ipv4 (int type, int flags, struct prefix_ipv4 *p,
struct in_addr *gate, struct in_addr *src,
- unsigned int ifindex, vrf_id_t vrf_id, int table_id,
+ ifindex_t ifindex, vrf_id_t vrf_id, int table_id,
u_int32_t metric, u_int32_t mtu, u_char distance, safi_t safi)
{
struct rib *rib;
@@ -2076,7 +2077,8 @@
/* XXX factor with rib_delete_ipv6 */
int
rib_delete_ipv4 (int type, int flags, struct prefix_ipv4 *p,
- struct in_addr *gate, unsigned int ifindex, vrf_id_t vrf_id, safi_t safi)
+ struct in_addr *gate, ifindex_t ifindex,
+ vrf_id_t vrf_id, safi_t safi)
{
struct route_table *table;
struct route_node *rn;
@@ -2558,7 +2560,7 @@
int
rib_add_ipv6 (int type, int flags, struct prefix_ipv6 *p,
- struct in6_addr *gate, unsigned int ifindex,
+ struct in6_addr *gate, ifindex_t ifindex,
vrf_id_t vrf_id, int table_id,
u_int32_t metric, u_int32_t mtu, u_char distance, safi_t safi)
{
@@ -2666,7 +2668,8 @@
/* XXX factor with rib_delete_ipv6 */
int
rib_delete_ipv6 (int type, int flags, struct prefix_ipv6 *p,
- struct in6_addr *gate, unsigned int ifindex, vrf_id_t vrf_id, safi_t safi)
+ struct in6_addr *gate, ifindex_t ifindex,
+ vrf_id_t vrf_id, safi_t safi)
{
struct route_table *table;
struct route_node *rn;
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c
index bd9be53..da9cb13 100644
--- a/zebra/zebra_routemap.c
+++ b/zebra/zebra_routemap.c
@@ -134,7 +134,7 @@
struct nexthop_vrfid *nh_vrf;
struct nexthop *nexthop;
char *ifname = rule;
- unsigned int ifindex;
+ ifindex_t ifindex;
if (type == RMAP_ZEBRA)
{
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 2fd10d9..e624ef2 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -827,7 +827,7 @@
u_char nexthop_num;
u_char nexthop_type;
struct stream *s;
- unsigned int ifindex;
+ ifindex_t ifindex;
u_char ifname_len;
safi_t safi;