As done for bgpd recently, rename if_mediatype to if_type.
Rationale: if_type values come from the IFT_ namespace in if_types.h,
not from the IFM_ namespace from if_media.h. This change prevents
confusion between uint8_t interface types and uint64_t media types.
Remove get_ifms_type() from dvmrpctl. It is never called, and is
outdated since it still assumes a 32 bit media word (which was grown
to 64 bit recently).
ok?
Index: dvmrpctl/dvmrpctl.c
===================================================================
RCS file: /cvs/src/usr.sbin/dvmrpctl/dvmrpctl.c,v
retrieving revision 1.11
diff -u -p -r1.11 dvmrpctl.c
--- dvmrpctl/dvmrpctl.c 14 Nov 2013 20:48:51 -0000 1.11
+++ dvmrpctl/dvmrpctl.c 26 Sep 2015 17:47:24 -0000
@@ -24,7 +24,6 @@
#include <netinet/in.h>
#include <netinet/ip_mroute.h>
#include <arpa/inet.h>
-#include <net/if_media.h>
#include <net/if_types.h>
#include <err.h>
@@ -43,7 +42,6 @@
__dead void usage(void);
int show_summary_msg(struct imsg *);
-int get_ifms_type(int);
int show_interface_msg(struct imsg *);
int show_interface_detail_msg(struct imsg *);
int show_igmp_msg(struct imsg *);
@@ -59,7 +57,7 @@ int show_rib_msg(struct imsg *);
int show_rib_detail_msg(struct imsg *);
int show_mfc_msg(struct imsg *);
int show_mfc_detail_msg(struct imsg *);
-const char * get_linkstate(int, int);
+const char * get_linkstate(uint8_t, int);
struct imsgbuf *ibuf;
@@ -256,25 +254,6 @@ show_summary_msg(struct imsg *imsg)
}
int
-get_ifms_type(int mediatype)
-{
- switch (mediatype) {
- case IFT_ETHER:
- return (IFM_ETHER);
- break;
- case IFT_FDDI:
- return (IFM_FDDI);
- break;
- case IFT_CARP:
- return (IFM_CARP);
- break;
- default:
- return (0);
- break;
- }
-}
-
-int
show_interface_msg(struct imsg *imsg)
{
struct ctl_iface *iface;
@@ -291,7 +270,7 @@ show_interface_msg(struct imsg *imsg)
iface->name, netid, if_state_name(iface->state),
iface->probe_timer == 0 ? "00:00:00" :
fmt_timeframe_core(iface->probe_timer),
- get_linkstate(iface->mediatype, iface->linkstate),
+ get_linkstate(iface->if_type, iface->linkstate),
iface->uptime == 0 ? "00:00:00" :
fmt_timeframe_core(iface->uptime), iface->group_cnt);
free(netid);
@@ -322,7 +301,7 @@ show_interface_detail_msg(struct imsg *i
inet_ntoa(iface->addr),
mask2prefixlen(iface->mask.s_addr));
printf(" Linkstate %s\n",
- get_linkstate(iface->mediatype, iface->linkstate));
+ get_linkstate(iface->if_type, iface->linkstate));
printf(" Network type %s, cost: %d\n",
if_type_name(iface->type), iface->metric);
printf(" State %s, querier ", if_state_name(iface->state));
@@ -668,13 +647,13 @@ const struct if_status_description
if_status_descriptions[] = LINK_STATE_DESCRIPTIONS;
const char *
-get_linkstate(int media_type, int link_state)
+get_linkstate(uint8_t if_type, int link_state)
{
const struct if_status_description *p;
static char buf[8];
for (p = if_status_descriptions; p->ifs_string != NULL; p++) {
- if (LINK_STATE_DESC_MATCH(p, media_type, link_state))
+ if (LINK_STATE_DESC_MATCH(p, if_type, link_state))
return (p->ifs_string);
}
snprintf(buf, sizeof(buf), "[#%d]", link_state);
Index: dvmrpd/dvmrpd.h
===================================================================
RCS file: /cvs/src/usr.sbin/dvmrpd/dvmrpd.h,v
retrieving revision 1.20
diff -u -p -r1.20 dvmrpd.h
--- dvmrpd/dvmrpd.h 2 Nov 2009 20:31:50 -0000 1.20
+++ dvmrpd/dvmrpd.h 26 Sep 2015 17:37:37 -0000
@@ -222,7 +222,7 @@ struct iface {
u_int8_t robustness;
u_int8_t linkstate;
- u_int8_t media_type;
+ u_int8_t if_type;
u_int8_t passive;
u_int8_t igmp_version;
};
@@ -264,7 +264,7 @@ struct kif {
int flags;
int mtu;
u_short ifindex;
- u_int8_t media_type;
+ u_int8_t if_type;
u_int8_t link_state;
u_int8_t nh_reachable; /* for nexthop verification */
};
@@ -310,7 +310,7 @@ struct ctl_iface {
enum iface_type type;
u_int8_t robustness;
u_int8_t linkstate;
- u_int8_t mediatype;
+ u_int8_t if_type;
u_int8_t passive;
u_int8_t igmp_version;
};
Index: dvmrpd/interface.c
===================================================================
RCS file: /cvs/src/usr.sbin/dvmrpd/interface.c,v
retrieving revision 1.10
diff -u -p -r1.10 interface.c
--- dvmrpd/interface.c 4 Jul 2011 04:34:14 -0000 1.10
+++ dvmrpd/interface.c 26 Sep 2015 17:37:51 -0000
@@ -197,7 +197,7 @@ if_new(struct kif *kif)
iface->ifindex = kif->ifindex;
iface->flags = kif->flags;
iface->linkstate = kif->link_state;
- iface->media_type = kif->media_type;
+ iface->if_type = kif->if_type;
iface->baudrate = kif->baudrate;
/* get address */
@@ -672,7 +672,7 @@ if_to_ctl(struct iface *iface)
ictl.linkstate = iface->linkstate;
ictl.passive = iface->passive;
ictl.igmp_version = iface->igmp_version;
- ictl.mediatype = iface->media_type;
+ ictl.if_type = iface->if_type;
gettimeofday(&now, NULL);
if (evtimer_pending(&iface->probe_timer, &tv)) {
Index: dvmrpd/kroute.c
===================================================================
RCS file: /cvs/src/usr.sbin/dvmrpd/kroute.c,v
retrieving revision 1.11
diff -u -p -r1.11 kroute.c
--- dvmrpd/kroute.c 11 Feb 2015 05:56:27 -0000 1.11
+++ dvmrpd/kroute.c 26 Sep 2015 17:38:31 -0000
@@ -237,7 +237,7 @@ if_change(u_short ifindex, int flags, st
kif->k.flags = flags;
kif->k.link_state = ifd->ifi_link_state;
- kif->k.media_type = ifd->ifi_type;
+ kif->k.if_type = ifd->ifi_type;
kif->k.baudrate = ifd->ifi_baudrate;
if ((reachable = (flags & IFF_UP) &&
@@ -345,7 +345,7 @@ fetchifs(int ifindex)
kif->k.ifindex = ifm.ifm_index;
kif->k.flags = ifm.ifm_flags;
kif->k.link_state = ifm.ifm_data.ifi_link_state;
- kif->k.media_type = ifm.ifm_data.ifi_type;
+ kif->k.if_type = ifm.ifm_data.ifi_type;
kif->k.baudrate = ifm.ifm_data.ifi_baudrate;
kif->k.mtu = ifm.ifm_data.ifi_mtu;
kif->k.nh_reachable = (kif->k.flags & IFF_UP) &&