Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/netstat/nhops.c
Show First 20 Lines • Show All 306 Lines • ▼ Show 20 Lines | if (nh->aifindex < (uint32_t)ifmap_size && nh->ifindex != nh->aifindex) { | ||||
if (*iface_name == '\0') | if (*iface_name == '\0') | ||||
strlcpy(iface_name, "---", sizeof(iface_name)); | strlcpy(iface_name, "---", sizeof(iface_name)); | ||||
} | } | ||||
if (Wflag) | if (Wflag) | ||||
xo_emit("{t:address-interface-name/%*s}", wid_if, iface_name); | xo_emit("{t:address-interface-name/%*s}", wid_if, iface_name); | ||||
xo_emit("{t:refcount/%*lu} ", wid_refcnt, nh->nh_refcount); | xo_emit("{t:refcount/%*lu} ", wid_refcnt, nh->nh_refcount); | ||||
if (Wflag && nh->prepend_len) { | if (Wflag && nh->prepend_len) { | ||||
char *prepend_hex = "AABBCCDDEE"; | for (int i = 0; i < nh->prepend_len; i++) | ||||
xo_emit(" {:nhop-prepend/%*s}", wid_prepend, prepend_hex); | snprintf(&buffer[i * 2], 3, "%02X", nh->nh_prepend[i]); | ||||
xo_emit(" {:nhop-prepend/%*s}", wid_prepend, buffer); | |||||
} | } | ||||
xo_emit("\n"); | xo_emit("\n"); | ||||
xo_close_instance(name); | xo_close_instance(name); | ||||
} | } | ||||
static int | static int | ||||
cmp_nh_idx(const void *_a, const void *_b) | cmp_nh_idx(const void *_a, const void *_b) | ||||
▲ Show 20 Lines • Show All 156 Lines • Show Last 20 Lines |