.Nm
.Op Fl L
.Op Fl m
+.Op Fl r
.Ar interface
.Op Cm create
.Op Ar address_family
.Op Fl L
.Op Fl d
.Op Fl m
+.Op Fl r
.Op Fl u
.Op Fl v
.Op Ar address_family
.Op Fl L
.Op Fl d
.Op Fl m
+.Op Fl r
.Op Fl u
.Op Fl v
.Op Fl C
the system, with no additional information.
Use of this flag is mutually exclusive with all other flags and commands.
.Pp
+The
+.Fl r
+flag may be used to show additional information related to the count of route references on the network interface.
+.Pp
For bridge interfaces, the list of addresses learned by the bridge is not shown when displaying information about
all interfaces except when the
.Fl v
int bond_details = 0;
int supmedia = 0;
+int showrtref = 0;
int printkeys = 0; /* Print keying material for interfaces. */
static int ifconfig(int argc, char *const *argv, int iscreate,
#ifndef __APPLE__
strlcpy(options, "adklmnuv", sizeof(options));
#else
- strlcpy(options, "adlmuv", sizeof(options));
+ strlcpy(options, "adlmruv", sizeof(options));
#endif
for (p = opts; p != NULL; p = p->next)
strlcat(options, p->opt, sizeof(options));
printkeys++;
break;
#endif
- case 'l': /* scan interface names only */
+ case 'l': /* scan interface names only */
namesonly++;
break;
case 'm': /* show media choices in status */
noload++;
break;
#endif
- case 'u': /* restrict scan to "up" interfaces */
+ case 'r':
+ showrtref++;
+ break;
+ case 'u': /* restrict scan to "up" interfaces */
uponly++;
break;
case 'v':
argc -= optind;
argv += optind;
- /* -l cannot be used with -a or -m or -b */
- if (namesonly && (all || supmedia || bond_details))
+ /* -l cannot be used with -a or -r or -m or -b */
+ if (namesonly && (all || supmedia || showrtref || bond_details))
usage();
/* nonsense.. */
printf(" metric %d", ifr.ifr_metric);
if (ioctl(s, SIOCGIFMTU, &ifr) != -1)
printf(" mtu %d", ifr.ifr_mtu);
+#ifdef SIOCGIFGETRTREFCNT
+ if (showrtref && ioctl(s, SIOCGIFGETRTREFCNT, &ifr) != -1)
+ printf(" rtref %d", ifr.ifr_route_refcnt);
+#endif
putchar('\n');
#ifndef __APPLE__
errx(1, "must specify a parent device for vlan create");
ifr->ifr_data = (caddr_t) ¶ms;
}
-#if SIOCIFCREATE2
+#ifdef SIOCIFCREATE2
if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
err(1, "SIOCIFCREATE2");
#else
u_int64_t ift_dr; /* drops */
u_int64_t ift_ib; /* input bytes */
u_int64_t ift_ob; /* output bytes */
+ u_int64_t ift_obgp; /* output bg packets */
+ u_int64_t ift_obgb; /* output bg bytes */
};
u_char signalled; /* set if alarm goes off "early" */
"packets", "errs", "bytes", "packets", "errs", "bytes", "colls");
if (dflag)
printf(" %5.5s", "drops");
+ if (prioflag)
+ printf(" %10s %10s", "obgpkts", "obgbytes");
putchar('\n');
fflush(stdout);
line = 0;
ifmd.ifmd_data.ifi_collisions - interesting->ift_co);
if (dflag)
printf(" %5llu", ifmd.ifmd_snd_drops - interesting->ift_dr);
+ if (prioflag)
+ printf(" %10llu %10llu",
+ ifmd.ifmd_filler[0] - interesting->ift_obgp,
+ ifmd.ifmd_filler[1] - interesting->ift_obgb);
}
interesting->ift_ip = ifmd.ifmd_data.ifi_ipackets;
interesting->ift_ie = ifmd.ifmd_data.ifi_ierrors;
interesting->ift_ob = ifmd.ifmd_data.ifi_obytes;
interesting->ift_co = ifmd.ifmd_data.ifi_collisions;
interesting->ift_dr = ifmd.ifmd_snd_drops;
+ /* private counters */
+ interesting->ift_obgp = ifmd.ifmd_filler[0];
+ interesting->ift_obgb = ifmd.ifmd_filler[1];
} else {
unsigned int latest_ifcount;
sum->ift_ob = 0;
sum->ift_co = 0;
sum->ift_dr = 0;
+ sum->ift_obgp = 0;
+ sum->ift_obgb = 0;
for (i = 0; i < ifcount; i++) {
struct ifmibdata *ifmd = ifmdall + i;
sum->ift_ob += ifmd->ifmd_data.ifi_obytes;
sum->ift_co += ifmd->ifmd_data.ifi_collisions;
sum->ift_dr += ifmd->ifmd_snd_drops;
+ /* private counters */
+ sum->ift_obgp += ifmd->ifmd_filler[0];
+ sum->ift_obgb += ifmd->ifmd_filler[1];
}
if (!first) {
printf("%10llu %5llu %10llu %10llu %5llu %10llu %5llu",
sum->ift_co - total->ift_co);
if (dflag)
printf(" %5llu", sum->ift_dr - total->ift_dr);
+ if (prioflag)
+ printf(" %10llu %10llu",
+ sum->ift_obgp - total->ift_obgp,
+ sum->ift_obgb - total->ift_obgb);
}
*total = *sum;
}
int aflag; /* show all sockets (including servers) */
int bflag; /* show i/f total bytes in/out */
int dflag; /* show i/f dropped packets */
-#if defined(__APPLE__) && !TARGET_OS_EMBEDDED
+#if defined(__APPLE__)
int gflag; /* show group (multicast) routing or stats */
#endif
int iflag; /* show interfaces */
int mflag; /* show memory stats */
int nflag; /* show addresses numerically */
static int pflag; /* show given protocol */
+int prioflag; /* show packet priority statistics */
int rflag; /* show routing tables (or routing stats) */
int sflag; /* show protocol statistics */
int tflag; /* show i/f watchdog timers */
af = AF_UNSPEC;
- while ((ch = getopt(argc, argv, "Aabdf:gI:iLlmnp:rRstuWw:")) != -1)
+ while ((ch = getopt(argc, argv, "Aabdf:gI:iLlmnPp:rRstuWw:")) != -1)
switch(ch) {
case 'A':
Aflag = 1;
errx(1, "%s: unknown address family", optarg);
}
break;
-#if defined(__APPLE__) && !TARGET_OS_EMBEDDED
+#if defined(__APPLE__)
case 'g':
gflag = 1;
break;
case 'n':
nflag = 1;
break;
+ case 'P':
+ prioflag = 1;
+ break;
case 'p':
if ((tp = name2protox(optarg)) == NULL) {
errx(1,
routepr(nl[N_RTREE].n_value);
exit(0);
}
-#if defined(__APPLE__) && !TARGET_OS_EMBEDDED
+#if defined(__APPLE__)
if (gflag) {
+#if !TARGET_OS_EMBEDDED
if (sflag) {
if (af == AF_INET || af == AF_UNSPEC)
mrt_stats();
mroute6pr();
#endif
}
+#endif /* !TARGET_OS_EMBEDDED */
ifmalist_dump();
exit(0);
}
G RTF_GATEWAY Destination requires forwarding by intermediary
H RTF_HOST Host entry (net otherwise)
I RTF_IFSCOPE Route is associated with an interface scope
+i RTF_IFREF Route is holding a reference to the interface
L RTF_LLINFO Valid protocol to link address translation
M RTF_MODIFIED Modified dynamically (by redirect)
m RTF_MULTICAST The route represents a multicast address
extern int nflag; /* show addresses numerically */
extern int rflag; /* show routing tables (or routing stats) */
extern int sflag; /* show protocol statistics */
+extern int prioflag; /* show packet priority statistics */
extern int tflag; /* show i/f watchdog timers */
extern int Wflag; /* wide display */
{ RTF_BLACKHOLE,'B' },
{ RTF_BROADCAST,'b' },
{ RTF_IFSCOPE, 'I' },
+ { RTF_IFREF, 'i' },
{ 0 }
};
"\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE\010DELCLONE"
"\011CLONING\012XRESOLVE\013LLINFO\014STATIC\015BLACKHOLE\016b016"
"\017PROTO2\020PROTO1\021PRCLONING\022WASCLONED\023PROTO3\024b024"
-"\025PINNED\026LOCAL\027BROADCAST\030MULTICAST\031IFSCOPE";
+"\025PINNED\026LOCAL\027BROADCAST\030MULTICAST\031IFSCOPE\032CONDEMNED"
+"\033IFREF";
char ifnetflags[] =
"\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5PTP\6b6\7RUNNING\010NOARP"
"\011PPROMISC\012ALLMULTI\013OACTIVE\014SIMPLEX\015LINK0\016LINK1"
(long)rtm->rtm_pid, rtm->rtm_seq, rtm->rtm_errno);
if (rtm->rtm_flags & RTF_IFSCOPE)
(void) printf("ifscope %d, ", rtm->rtm_index);
+ if (rtm->rtm_flags & RTF_IFREF)
+ (void) printf("ifref, ");
(void) printf("flags:");
bprintf(stdout, rtm->rtm_flags, routeflags);
pmsg_common(rtm);