Permalink
Browse files

rt_metrics: Add rmx_iw* to record user-set IW parameters

  • Loading branch information...
1 parent c78a42c commit bf522a910724004644c81f18dd228361fdb88b74 Sepherosa Ziehau committed Apr 12, 2012
Showing with 46 additions and 8 deletions.
  1. +2 −0 sbin/route/keywords
  2. +10 −4 sbin/route/route.c
  3. +4 −1 sys/net/route.h
  4. +2 −0 sys/net/rtsock.c
  5. +28 −3 usr.bin/netstat/route.c
View
@@ -55,3 +55,5 @@ x25
xns
xresolve
msl
+iwmax
+iw
View
@@ -563,6 +563,8 @@ set_metric(char *value, int key)
caseof(K_RTT, RTV_RTT, rmx_rtt);
caseof(K_RTTVAR, RTV_RTTVAR, rmx_rttvar);
caseof(K_MSL, RTV_MSL, rmx_msl);
+ caseof(K_IWMAX, RTV_IWMAXSEGS, rmx_iwmaxsegs);
+ caseof(K_IW, RTV_IWCAPSEGS, rmx_iwcapsegs);
}
rtm_inits |= flag;
if (lockrest || locking)
@@ -763,6 +765,8 @@ newroute(int argc, char **argv)
case K_RTT:
case K_RTTVAR:
case K_MSL:
+ case K_IWMAX:
+ case K_IW:
if (--argc == 0)
usage(NULL);
set_metric(*++argv, key);
@@ -1376,8 +1380,8 @@ const char *msgtypes[] = {
};
char metricnames[] =
-"\011msl\010rttvar\7rtt\6ssthresh\5sendpipe\4recvpipe\3expire\2hopcount"
-"\1mtu";
+"\013iw\012iwmax\011msl\010rttvar\7rtt\6ssthresh\5sendpipe\4recvpipe\3expire"
+"\2hopcount\1mtu";
char routeflags[] =
"\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE\010MASK_PRESENT"
"\011CLONING\012XRESOLVE\013LLINFO\014STATIC\015BLACKHOLE\016b016"
@@ -1529,7 +1533,7 @@ print_getmsg(struct rt_msghdr *rtm, int msglen)
#define msec(u) (((u) + 500) / 1000) /* usec to msec */
printf("\n%s\n", "\
- recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu expire msl,msec");
+ recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu expire msl,msec iwmax iw");
printf("%8ld%c ", rtm->rtm_rmx.rmx_recvpipe, lock(RPIPE));
printf("%8ld%c ", rtm->rtm_rmx.rmx_sendpipe, lock(SPIPE));
printf("%8ld%c ", rtm->rtm_rmx.rmx_ssthresh, lock(SSTHRESH));
@@ -1540,7 +1544,9 @@ print_getmsg(struct rt_msghdr *rtm, int msglen)
if (rtm->rtm_rmx.rmx_expire != 0)
rtm->rtm_rmx.rmx_expire -= time(0);
printf("%8ld%c ", rtm->rtm_rmx.rmx_expire, lock(EXPIRE));
- printf("%8ld\n", rtm->rtm_rmx.rmx_msl);
+ printf("%8ld ", rtm->rtm_rmx.rmx_msl);
+ printf("%5ld ", rtm->rtm_rmx.rmx_iwmaxsegs);
+ printf("%3ld\n", rtm->rtm_rmx.rmx_iwcapsegs);
#undef lock
#undef msec
#define RTA_IGN (RTA_DST|RTA_GATEWAY|RTA_NETMASK|RTA_IFP|RTA_IFA|RTA_BRD)
View
@@ -117,7 +117,8 @@ struct rt_metrics { /* grouped for locality of reference */
u_short rmx_mssopt; /* peer's cached MSS */
u_short rmx_pad; /* explicit pad */
u_long rmx_msl; /* maximum segment lifetime, unit: ms */
- u_long rmx_filler[2]; /* for future expansion */
+ u_long rmx_iwmaxsegs; /* IW segments max */
+ u_long rmx_iwcapsegs; /* IW segments */
};
/*
@@ -273,6 +274,8 @@ struct rt_msghdr {
#define RTV_RTT 0x40 /* init or lock _rtt */
#define RTV_RTTVAR 0x80 /* init or lock _rttvar */
#define RTV_MSL 0x100 /* init or lock _msl */
+#define RTV_IWMAXSEGS 0x200 /* init or lock _iwmaxsegs */
+#define RTV_IWCAPSEGS 0x400 /* init or lock _iwcapsegs */
/*
* Bitmask values for rtm_addrs.
View
@@ -789,6 +789,8 @@ rt_setmetrics(u_long which, struct rt_metrics *in, struct rt_metrics *out)
setmetric(RTV_MTU, rmx_mtu);
setmetric(RTV_EXPIRE, rmx_expire);
setmetric(RTV_MSL, rmx_msl);
+ setmetric(RTV_IWMAXSEGS, rmx_iwmaxsegs);
+ setmetric(RTV_IWCAPSEGS, rmx_iwcapsegs);
#undef setmetric
}
View
@@ -247,6 +247,8 @@ static int wid_if;
static int wid_expire;
static int wid_mplslops;
static int wid_msl;
+static int wid_iwmax;
+static int wid_iw;
static void
size_cols(int ef, struct radix_node *rn)
@@ -261,6 +263,8 @@ size_cols(int ef, struct radix_node *rn)
wid_expire = 6;
wid_mplslops = 7;
wid_msl = 7;
+ wid_iwmax = 5;
+ wid_iw = 2;
if (Wflag)
size_cols_tree(rn);
@@ -363,6 +367,16 @@ size_cols_rtentry(struct rtentry *rt)
"%lu", rt->rt_rmx.rmx_msl);
wid_msl = MAX(len, wid_msl);
}
+ if (rt->rt_rmx.rmx_iwmaxsegs) {
+ len = snprintf(buffer, sizeof(buffer),
+ "%lu", rt->rt_rmx.rmx_iwmaxsegs);
+ wid_iwmax = MAX(len, wid_iwmax);
+ }
+ if (rt->rt_rmx.rmx_iwcapsegs) {
+ len = snprintf(buffer, sizeof(buffer),
+ "%lu", rt->rt_rmx.rmx_iwcapsegs);
+ wid_iw = MAX(len, wid_iw);
+ }
}
}
@@ -378,7 +392,8 @@ pr_rthdr(int af1)
printf("%-8.8s ","Address");
if (af1 == AF_INET || Wflag) {
if (Wflag) {
- printf("%-*.*s %-*.*s %-*.*s %*.*s %*.*s %*.*s %*.*s %*s %-*s %*s\n",
+ printf("%-*.*s %-*.*s %-*.*s %*.*s %*.*s %*.*s %*.*s "
+ "%*s %-*s%*s %*s %*s\n",
wid_dst, wid_dst, "Destination",
wid_gw, wid_gw, "Gateway",
wid_flags, wid_flags, "Flags",
@@ -388,7 +403,9 @@ pr_rthdr(int af1)
wid_if, wid_if, "Netif",
wid_expire, "Expire",
wid_mplslops, "Labelops",
- wid_msl, "Msl");
+ wid_msl, "Msl",
+ wid_iwmax, "IWmax",
+ wid_iw, "IW");
} else {
printf("%-*.*s %-*.*s %-*.*s %*.*s %*.*s %*.*s %*s\n",
wid_dst, wid_dst, "Destination",
@@ -801,7 +818,15 @@ p_rtentry(struct rtentry *rt)
if (rt->rt_rmx.rmx_msl != 0)
printf(" %*lu", wid_msl, rt->rt_rmx.rmx_msl);
else
- printf(" %*s", wid_msl, "");
+ printf("%*s ", wid_msl, "");
+ if (rt->rt_rmx.rmx_iwmaxsegs != 0)
+ printf(" %*lu", wid_iwmax, rt->rt_rmx.rmx_iwmaxsegs);
+ else
+ printf("%*s ", wid_iwmax, "");
+ if (rt->rt_rmx.rmx_iwcapsegs != 0)
+ printf(" %*lu", wid_iw, rt->rt_rmx.rmx_iwcapsegs);
+ else
+ printf("%*s ", wid_iw, "");
}
putchar('\n');
}

0 comments on commit bf522a9

Please sign in to comment.