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