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