*: use an ifindex_t type, defined in lib/if.h, for ifindex values
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;