Add nic number as arg to ethdump.

This commit is contained in:
Ali Mashtizadeh 2023-11-24 17:00:23 -05:00
parent 4b926b6ca9
commit 82ca7dbcb3

View File

@ -1,12 +1,14 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <syscall.h> #include <syscall.h>
#include <sys/nic.h> #include <sys/nic.h>
#include <net/ethernet.h> #include <net/ethernet.h>
static int nicNo = 1; static int nicNo = 0;
static char buf[4096]; static char buf[4096];
static MBuf mbuf; static MBuf mbuf;
@ -61,6 +63,10 @@ main(int argc, const char *argv[])
printf("Ethernet Dump Tool\n"); printf("Ethernet Dump Tool\n");
if (argc == 2) {
nicNo = atoi(argv[1]);
}
status = OSNICStat(nicNo, &nic); status = OSNICStat(nicNo, &nic);
if (status == ENOENT) { if (status == ENOENT) {
printf("nic%d not present\n", nicNo); printf("nic%d not present\n", nicNo);