summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorOlivier Cochard <olivier@FreeBSD.org>2020-11-30 15:04:35 +0000
committerOlivier Cochard <olivier@FreeBSD.org>2020-11-30 15:04:35 +0000
commit6b97a6e365b9a6d68d2828a3c1a6c65a85815af8 (patch)
treea89c6a67df73b5ef38841f6446f50fa1d8035214 /tools
parentb2e9e573a392a973bea0ff180932913b7aa0eb66 (diff)
downloadsrc-test2-6b97a6e365b9a6d68d2828a3c1a6c65a85815af8.tar.gz
src-test2-6b97a6e365b9a6d68d2828a3c1a6c65a85815af8.zip
Fix compilation on head and while here:
- remove unwanted whitespaces - remove useless function ifphys() - fix the Makefile to install it into /usr/bin PR: 250133 Reviewed by: glebius, maxim Approved by: glebius Differential Revision: https://reviews.freebsd.org/D27155
Notes
Notes: svn path=/head/; revision=368188
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/ifinfo/Makefile1
-rw-r--r--tools/tools/ifinfo/ifinfo.c32
2 files changed, 11 insertions, 22 deletions
diff --git a/tools/tools/ifinfo/Makefile b/tools/tools/ifinfo/Makefile
index 019be92a5fe9..21c2981fdb6d 100644
--- a/tools/tools/ifinfo/Makefile
+++ b/tools/tools/ifinfo/Makefile
@@ -3,5 +3,6 @@
PROG= ifinfo
SRCS= ifinfo.c rfc1650.c
MAN=
+BINDIR?= /usr/bin
.include <bsd.prog.mk>
diff --git a/tools/tools/ifinfo/ifinfo.c b/tools/tools/ifinfo/ifinfo.c
index d4360d01b3a4..dea7d6ff8244 100644
--- a/tools/tools/ifinfo/ifinfo.c
+++ b/tools/tools/ifinfo/ifinfo.c
@@ -12,7 +12,7 @@
* no representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied
* warranty.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
* ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
@@ -49,7 +49,6 @@
static void printit(const struct ifmibdata *, const char *);
static const char *iftype(int);
-static const char *ifphys(int, int);
static int isit(int, char **, const char *);
static printfcn findlink(int);
@@ -83,7 +82,7 @@ main(int argc, char **argv)
usage(argv[0]);
}
}
-
+
retval = 1;
name[0] = CTL_NET;
@@ -132,15 +131,15 @@ main(int argc, char **argv)
if (dolink && (pf = findlink(ifmd.ifmd_data.ifi_type))) {
name[5] = IFDATA_LINKSPECIFIC;
if (sysctl(name, 6, 0, &linkmiblen, 0, 0) < 0)
- err(EX_OSERR,
+ err(EX_OSERR,
"sysctl(net.link.ifdata.%d.linkspec) size",
i);
linkmib = malloc(linkmiblen);
if (!linkmib)
- err(EX_OSERR, "malloc(%lu)",
+ err(EX_OSERR, "malloc(%lu)",
(u_long)linkmiblen);
if (sysctl(name, 6, linkmib, &linkmiblen, 0, 0) < 0)
- err(EX_OSERR,
+ err(EX_OSERR,
"sysctl(net.link.ifdata.%d.linkspec)",
i);
pf(linkmib, linkmiblen);
@@ -165,15 +164,13 @@ printit(const struct ifmibdata *ifmd, const char *dname)
printf("\tsend queue max length: %d\n", ifmd->ifmd_snd_maxlen);
printf("\tsend queue drops: %d\n", ifmd->ifmd_snd_drops);
printf("\ttype: %s\n", iftype(ifmd->ifmd_data.ifi_type));
- printf("\tphysical: %s\n", ifphys(ifmd->ifmd_data.ifi_type,
- ifmd->ifmd_data.ifi_physical));
printf("\taddress length: %d\n", ifmd->ifmd_data.ifi_addrlen);
printf("\theader length: %d\n", ifmd->ifmd_data.ifi_hdrlen);
printf("\tlink state: %u\n", ifmd->ifmd_data.ifi_link_state);
printf("\tvhid: %u\n", ifmd->ifmd_data.ifi_vhid);
printf("\tdatalen: %u\n", ifmd->ifmd_data.ifi_datalen);
- printf("\tmtu: %lu\n", ifmd->ifmd_data.ifi_mtu);
- printf("\tmetric: %lu\n", ifmd->ifmd_data.ifi_metric);
+ printf("\tmtu: %u\n", ifmd->ifmd_data.ifi_mtu);
+ printf("\tmetric: %u\n", ifmd->ifmd_data.ifi_metric);
printf("\tline rate: %lu bit/s\n", ifmd->ifmd_data.ifi_baudrate);
printf("\tpackets received: %lu\n", ifmd->ifmd_data.ifi_ipackets);
printf("\tinput errors: %lu\n", ifmd->ifmd_data.ifi_ierrors);
@@ -185,7 +182,7 @@ printit(const struct ifmibdata *ifmd, const char *dname)
printf("\tmulticasts received: %lu\n", ifmd->ifmd_data.ifi_imcasts);
printf("\tmulticasts transmitted: %lu\n", ifmd->ifmd_data.ifi_omcasts);
printf("\tinput queue drops: %lu\n", ifmd->ifmd_data.ifi_iqdrops);
- printf("\tpackets for unknown protocol: %lu\n",
+ printf("\tpackets for unknown protocol: %lu\n",
ifmd->ifmd_data.ifi_noproto);
printf("\tHW offload capabilities: 0x%lx\n",
ifmd->ifmd_data.ifi_hwassist);
@@ -193,7 +190,7 @@ printit(const struct ifmibdata *ifmd, const char *dname)
ifmd->ifmd_data.ifi_epoch);
#ifdef notdef
printf("\treceive timing: %lu usec\n", ifmd->ifmd_data.ifi_recvtiming);
- printf("\ttransmit timing: %lu usec\n",
+ printf("\ttransmit timing: %lu usec\n",
ifmd->ifmd_data.ifi_xmittiming);
#endif
}
@@ -258,7 +255,7 @@ static const char *const if_types[] = {
"IPv6-to-IPv4 TCP relay capturing interface",
"6to4 tunnel interface"
};
-#define NIFTYPES ((sizeof if_types)/(sizeof if_types[0]))
+#define NIFTYPES (int)((sizeof if_types)/(sizeof if_types[0]))
static const char *
iftype(int type)
@@ -273,15 +270,6 @@ iftype(int type)
return if_types[type];
}
-static const char *
-ifphys(int type, int phys)
-{
- static char buf[256];
-
- sprintf(buf, "unknown physical %d", phys);
- return buf;
-}
-
static int
isit(int argc, char **argv, const char *name)
{