Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177373334
D57011.1794226357.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D57011.1794226357.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
@@ -50,6 +50,7 @@
int gw;
int flags;
int pksent;
+ int metric;
int mtu;
int iface;
int expire;
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,11 +205,12 @@
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.metric, wid.metric, "Metric",
wid.mtu, wid.mtu, "Mtu",
wid.iface, wid.iface, "Netif",
wid.expire, "Expire");
@@ -231,6 +232,7 @@
wid.gw = WID_GW_DEFAULT(fam);
wid.flags = 6;
wid.pksent = 8;
+ wid.metric = 8;
wid.mtu = 6;
wid.iface = WID_IF_DEFAULT;
wid.expire = 6;
@@ -326,12 +328,14 @@
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/%lu}", rtm->rtm_rmx.rmx_metric);
if (Wflag) {
/* XXX: use=0? */
xo_emit("{t:nhop/%*lu} ", wid.mtu, rtm->rtm_rmx.rmx_nhidx);
+ xo_emit("{t:metric/%*lu} ", wid.metric, rtm->rtm_rmx.rmx_metric);
if (rtm->rtm_rmx.rmx_mtu != 0)
xo_emit("{t:mtu/%*lu} ", wid.mtu, rtm->rtm_rmx.rmx_mtu);
else
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/%lu}", rt->rta_metric);
if (is_mpath)
xo_emit("{e:nhg-kidx/%u}", rt->rta_knh_id);
else
@@ -204,6 +205,7 @@
/* XXX: use=0? */
xo_emit("{t:nhop/%*lu} ", wid.mtu, is_mpath ? 0 : rt->rta_knh_id);
+ xo_emit("{t:metric/%*lu} ", wid.metric, rt->rta_metric);
if (rt->rtax_mtu != 0)
xo_emit("{t:mtu/%*lu} ", wid.mtu, rt->rtax_mtu);
else {
@@ -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
Mon, Nov 9, 12:12 PM (9 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41613672
Default Alt Text
D57011.1794226357.diff (2 KB)
Attached To
Mode
D57011: netstat(1): Show metric value for routes
Attached
Detach File
Event Timeline