Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157253935
D57011.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D57011.diff
View Options
diff --git a/usr.bin/netstat/common.h b/usr.bin/netstat/common.h
--- a/usr.bin/netstat/common.h
+++ b/usr.bin/netstat/common.h
@@ -52,6 +52,7 @@
int pksent;
int mtu;
int iface;
+ int metric;
int expire;
};
void set_wid(int fam);
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -205,13 +205,14 @@
if (Wflag) {
xo_emit("{T:/%-*.*s} {T:/%-*.*s} {T:/%-*.*s} {T:/%*.*s} "
- "{T:/%*.*s} {T:/%*.*s} {T:/%*s}\n",
+ "{T:/%*.*s} {T:/%*.*s} {T:/%*.*s} {T:/%*s}\n",
wid.dst, wid.dst, "Destination",
wid.gw, wid.gw, "Gateway",
wid.flags, wid.flags, "Flags",
wid.mtu, wid.mtu, "Nhop#",
wid.mtu, wid.mtu, "Mtu",
wid.iface, wid.iface, "Netif",
+ wid.metric, wid.metric, "Metric",
wid.expire, "Expire");
} else {
xo_emit("{T:/%-*.*s} {T:/%-*.*s} {T:/%-*.*s} {T:/%*.*s} "
@@ -233,6 +234,7 @@
wid.pksent = 8;
wid.mtu = 6;
wid.iface = WID_IF_DEFAULT;
+ wid.metric = 8;
wid.expire = 6;
}
@@ -326,8 +328,9 @@
snprintf(buffer, sizeof(buffer), "{[:-%d}{:flags/%%s}{]:} ",
wid.flags - protrusion);
p_flags(rtm->rtm_flags, buffer);
- /* Output path weight as non-visual property */
+ /* Output path weight and metric as non-visual property */
xo_emit("{e:weight/%u}", rtm->rtm_rmx.rmx_weight);
+ xo_emit("{e:metric/%u}", rtm->rtm_rmx.rmx_metric);
if (Wflag) {
/* XXX: use=0? */
xo_emit("{t:nhop/%*lu} ", wid.mtu, rtm->rtm_rmx.rmx_nhidx);
@@ -346,9 +349,10 @@
strlcpy(prettyname, "---", sizeof(prettyname));
}
- if (Wflag)
+ if (Wflag) {
xo_emit("{t:interface-name/%*s}", wid.iface, prettyname);
- else
+ xo_emit("{t:metric/%*u} ", wid.metric, rtm->rtm_rmx.rmx_metric);
+ } else
xo_emit("{t:interface-name/%*.*s}", wid.iface, wid.iface,
prettyname);
if (rtm->rtm_rmx.rmx_expire) {
diff --git a/usr.bin/netstat/route_netlink.c b/usr.bin/netstat/route_netlink.c
--- a/usr.bin/netstat/route_netlink.c
+++ b/usr.bin/netstat/route_netlink.c
@@ -177,8 +177,9 @@
snprintf(buffer, sizeof(buffer), "{[:-%d}{:flags/%%s}{]:} ",
wid.flags - protrusion);
p_flags(rt->rta_rtflags | RTF_UP, buffer);
- /* Output path weight as non-visual property */
+ /* Output path weight and metric as non-visual property */
xo_emit("{e:weight/%u}", rt->rtax_weight);
+ xo_emit("{e:metric/%u}", rt->rta_metric);
if (is_mpath)
xo_emit("{e:nhg-kidx/%u}", rt->rta_knh_id);
else
@@ -213,9 +214,10 @@
}
- if (Wflag)
+ if (Wflag) {
xo_emit("{t:interface-name/%*s}", wid.iface, prettyname);
- else
+ xo_emit("{t:metric/%*u} ", wid.metric, rt->rta_metric);
+ } else
xo_emit("{t:interface-name/%*.*s}", wid.iface, wid.iface,
prettyname);
if (rt->rta_expire > 0) {
@@ -242,6 +244,7 @@
rt.rta_gw = nhop->gw;
rt.rta_oif = nhop->ifindex;
rt.rtax_weight = nhop->rtnh_weight;
+ rt.rta_metric = nhop->rta_metric;
rt.rta_rtflags = nhop->rta_rtflags ? nhop->rta_rtflags : orig_rtflags;
rt.rtax_mtu = nhop->rtax_mtu ? nhop->rtax_mtu : orig_mtu;
rt.rta_expire = nhop->rta_expire;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, May 20, 6:10 PM (14 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33353222
Default Alt Text
D57011.diff (2 KB)
Attached To
Mode
D57011: netstat(1): Show metric value for routes
Attached
Detach File
Event Timeline
Log In to Comment