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;
size_t len;
int source_as;
int dest_as;
- int ifindex;
+ ifindex_t ifindex;
int family;
struct in_addr sip;
struct in_addr dip;
int
bgp_connect (struct peer *peer)
{
- unsigned int ifindex = 0;
+ ifindex_t ifindex = 0;
if (peer->conf_if && BGP_PEER_SU_UNSPEC(peer))
{
#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;
}
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;
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;
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;
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 */
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. */
#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;
static int
nexthoplookup (struct list *nexthops, struct in_addr *ip,
- unsigned int ifindex)
+ ifindex_t ifindex)
{
struct listnode *node;
struct isis_nexthop *nh;
#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;
}
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;
static int
nexthop6lookup (struct list *nexthops6, struct in6_addr *ip6,
- unsigned int ifindex)
+ ifindex_t ifindex)
{
struct listnode *node;
struct isis_nexthop6 *nh6;
#ifdef HAVE_IPV6
struct isis_nexthop6
{
- unsigned int ifindex;
+ ifindex_t ifindex;
struct in6_addr ip6;
struct in6_addr router_address6;
unsigned int lock;
struct isis_nexthop
{
- unsigned int ifindex;
+ ifindex_t ifindex;
struct in_addr ip;
struct in_addr router_address;
unsigned int lock;
{
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;
/* 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!");
{
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;
/* 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!");
/* 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;
: IFINDEX_INTERNAL;
}
-unsigned int
+ifindex_t
ifname2ifindex (const char *name)
{
return ifname2ifindex_vrf (name, VRF_DEFAULT);
}
#ifndef HAVE_IF_NAMETOINDEX
-unsigned int
+ifindex_t
if_nametoindex (const char *name)
{
struct interface *ifp;
#ifndef HAVE_IF_INDEXTONAME
char *
-if_indextoname (unsigned int ifindex, char *name)
+if_indextoname (ifindex_t ifindex, char *name)
{
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;
#ifndef _ZEBRA_IF_H
#define _ZEBRA_IF_H
+#include "zebra.h"
#include "linklist.h"
/*
#define INTERFACE_NAMSIZ 20
#define INTERFACE_HWADDR_MAX 20
+typedef signed int ifindex_t;
+
#ifdef HAVE_PROC_NET_DEV
struct if_stats
{
/* 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;
/* 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);
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,
/* 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);
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. */
struct nexthop *prev;
/* Interface index. */
- unsigned int ifindex;
+ ifindex_t ifindex;
enum nexthop_types_t type;
int optname,
struct in_addr if_addr,
unsigned int mcast_addr,
- unsigned int ifindex)
+ ifindex_t ifindex)
{
#ifdef HAVE_RFC3678
struct group_req gr;
*/
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
}
static int
-setsockopt_ipv4_ifindex (int sock, int val)
+setsockopt_ipv4_ifindex (int sock, ifindex_t val)
{
int ret;
int
-setsockopt_ifindex (int af, int sock, int val)
+setsockopt_ifindex (int af, int sock, ifindex_t val)
{
int ret = -1;
* 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 */
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
}
/* return ifindex, 0 if none found */
-int
+ifindex_t
getsockopt_ifindex (int af, struct msghdr *msgh)
{
switch (af)
? 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.
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;
#define _ZEBRA_SOCKUNION_H
#include "privs.h"
+#include "if.h"
union sockunion
{
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 *);
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;
struct in_addr **nexthop;
u_char ifindex_num;
- unsigned int *ifindex;
+ ifindex_t *ifindex;
u_char distance;
struct in6_addr **nexthop;
u_char ifindex_num;
- unsigned int *ifindex;
+ ifindex_t *ifindex;
u_char distance;
}
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;
}
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;
struct in6_addr forwarding;
/* u_int32_t tag; */
- unsigned int ifindex;
+ ifindex_t ifindex;
};
/* AS-External-LSA */
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);
};
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;
/* 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 *);
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++;
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;
#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;
u_int32_t router_id;
/* Neighbor Interface ID */
- u_int32_t ifindex;
+ ifindex_t ifindex;
/* Router Priority of this neighbor */
u_char priority;
/* 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;
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;
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;
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 */
void
ospf6_route_zebra_copy_nexthops (struct ospf6_route *route,
- unsigned int *ifindexes,
+ ifindex_t *ifindexes,
struct in6_addr **nexthop_addr,
int entries)
{
struct ospf6_nexthop
{
/* Interface index */
- unsigned int ifindex;
+ ifindex_t ifindex;
/* IP address, if any */
struct in6_addr address;
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);
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;
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;
== MATCH_FAILED)
return NULL;
- ifindex = instid = 0;
-
/* Check OSPFv3 instance. */
if (ospf6 == NULL)
return NULL;
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;
== MATCH_FAILED)
return NULL;
- ifindex = instid = rtrid = 0;
+ instid = rtrid = 0;
/* Check OSPFv3 instance. */
if (ospf6 == NULL)
caddr_t lsdesc)
{
int i;
- unsigned int ifindex;
+ ifindex_t ifindex;
struct ospf6_interface *oi;
u_int16_t type;
u_int32_t adv_router;
char buf[PREFIX2STR_BUFFER];
int nhcount;
struct in6_addr **nexthops;
- unsigned int *ifindexes;
+ ifindex_t *ifindexes;
int ret = 0;
struct prefix_ipv6 *dest;
/* 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");
/* 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;
struct prefix_ipv4 p;
/* Interface index. */
- unsigned int ifindex;
+ ifindex_t ifindex;
/* Nexthop address. */
struct in_addr nexthop;
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);
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;
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 *);
/* 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;
int
ospf_if_drop_allspfrouters (struct ospf *top, struct prefix *p,
- unsigned int ifindex)
+ ifindex_t ifindex)
{
int ret;
/* 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;
}
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;
}
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;
/* 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);
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())];
{
struct in_addr nexthop;
struct in_addr adv_router;
- unsigned int ifindex;
+ ifindex_t ifindex;
unsigned char unnumbered;
};
struct ospf_snmp_if
{
struct in_addr addr;
- unsigned int ifindex;
+ ifindex_t ifindex;
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);
}
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;
}
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;
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;
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;
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;
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;
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;
}
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;
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;
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;
}
}
-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;
if (ifp->info) {
struct pim_interface *pim_ifp;
pim_ifp = ifp->info;
+
if (vif_index == pim_ifp->mroute_vif_index)
return ifp;
}
/*
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;
}
static int igmp_join_sock(const char *ifname,
- int ifindex,
+ ifindex_t ifindex,
struct in_addr group_addr,
struct in_addr source_addr)
{
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 */
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);
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;
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);
#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;
ifp = if_lookup_by_index(ifindex);
if (ifp) {
- zassert(ifindex == (int) ifp->ifindex);
+ zassert(ifindex == ifp->ifindex);
}
#ifdef PIM_REPORT_RECV_IFINDEX_MISMATCH
};
#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)
{
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);
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;
}
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;
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)
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;
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);
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;
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)",
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)",
struct in_addr source;
struct channel_oil c_oil;
- unsigned int iif;
+ ifindex_t iif;
unsigned char oif_ttls[MAXVIFS];
};
{
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;
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])),
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])),
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,
struct pim_zlookup_nexthop {
struct in_addr nexthop_addr;
- int ifindex;
+ ifindex_t ifindex;
uint32_t route_metric;
uint8_t protocol_distance;
};
#include <net/if.h>
#include <arpa/inet.h>
+#include "if.h"
#include "pim_igmp_join.h"
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)
const char *ifname;
const char *group;
const char *source;
- int ifindex;
+ ifindex_t ifindex;
int result;
int fd;
ipv4_multicast_join (int sock,
struct in_addr group,
struct in_addr ifa,
- unsigned int ifindex)
+ ifindex_t ifindex)
{
int ret;
ipv4_multicast_leave (int sock,
struct in_addr group,
struct in_addr ifa,
- unsigned int ifindex)
+ ifindex_t ifindex)
{
int ret;
/* 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;
/* 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;
/* 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;
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);
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;
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;
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 *);
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;
/* 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;
/* 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;
/* 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;
int sock;
struct sockaddr_in6 from;
struct ripng_packet *packet;
- unsigned int ifindex = 0;
+ ifindex_t ifindex = 0;
struct interface *ifp;
int hoplimit = -1;
struct in6_addr from;
/* Which interface does this route come from. */
- unsigned int ifindex;
+ ifindex_t ifindex;
/* Metric of this route. */
u_char metric;
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 *);
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;
* STATIC_IFINDEX uses ifindex
*/
union g_addr addr;
- unsigned int ifindex;
+ ifindex_t ifindex;
char ifname[INTERFACE_NAMSIZ + 1];
*/
};
-
/* The following for loop allows to iterate over the nexthop
* structure of routes.
*
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);
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);
* 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,
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);
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);
/* 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);
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];
struct nexthop *nexthop, *tnexthop;
int recursing;
int nexthop_num = 0;
- unsigned int ifindex = 0;
+ ifindex_t ifindex = 0;
int gate = 0;
int error;
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;
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;
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;
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);
exit (status);
}
-static unsigned int test_ifindex = 0;
+static ifindex_t test_ifindex = 0;
/* testrib commands */
DEFUN (test_interface_state,
#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"
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;
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;
struct nexthop *
rib_nexthop_ipv6_ifindex_add (struct rib *rib, struct in6_addr *ipv6,
- unsigned int ifindex)
+ ifindex_t ifindex)
{
struct nexthop *nexthop;
{
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;
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;
/* 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;
}
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)
{
}
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;
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;
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;
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;
/* 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;
/* 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;
{
struct nh_rmap_obj *nh_data;
char *ifname = rule;
- unsigned int ifindex;
+ ifindex_t ifindex;
if (type == RMAP_ZEBRA)
{
u_char nexthop_num;
u_char nexthop_type;
struct stream *s;
- unsigned int ifindex;
+ ifindex_t ifindex;
safi_t safi;
int ret;