Commit d1381f90 authored by Mike Frysinger's avatar Mike Frysinger

trim trailing whitespace

Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
parent 35eaa82d
...@@ -27,7 +27,7 @@ of the other options should work as well. ...@@ -27,7 +27,7 @@ of the other options should work as well.
COMPILE COMPILE
------- -------
To compile simply use "make". To compile simply use "make".
There should be no warnings or errors. There should be no warnings or errors.
......
...@@ -18,12 +18,12 @@ ...@@ -18,12 +18,12 @@
# Alan Cox <A.Cox@swansea.ac.uk> # Alan Cox <A.Cox@swansea.ac.uk>
# Copyright 1993-1994 Swansea University Computer Society # Copyright 1993-1994 Swansea University Computer Society
# #
# Be careful! # Be careful!
# This Makefile doesn't describe complete dependencies for all include files. # This Makefile doesn't describe complete dependencies for all include files.
# If you change include files you might need to do make clean. # If you change include files you might need to do make clean.
# #
# set the base of the Installation # set the base of the Installation
# BASEDIR = /mnt # BASEDIR = /mnt
BASEDIR ?= $(DESTDIR) BASEDIR ?= $(DESTDIR)
...@@ -129,7 +129,7 @@ distcheck: dist ...@@ -129,7 +129,7 @@ distcheck: dist
rm -rf net-tools-$(RELEASE) rm -rf net-tools-$(RELEASE)
@printf "\nThe tarball is ready to go:\n%s\n" "`du -b net-tools-$(RELEASE).tar.xz`" @printf "\nThe tarball is ready to go:\n%s\n" "`du -b net-tools-$(RELEASE).tar.xz`"
config.h: config.in Makefile config.h: config.in Makefile
@echo "Configuring the Linux net-tools (NET-3 Base Utilities)..." ; echo @echo "Configuring the Linux net-tools (NET-3 Base Utilities)..." ; echo
@if [ config.status -nt config.in ]; \ @if [ config.status -nt config.in ]; \
then ./configure.sh config.status; \ then ./configure.sh config.status; \
...@@ -157,7 +157,7 @@ subdirs: libdir ...@@ -157,7 +157,7 @@ subdirs: libdir
ifconfig: $(NET_LIB) ifconfig.o ifconfig: $(NET_LIB) ifconfig.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ ifconfig.o $(NLIB) $(RESLIB) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ifconfig.o $(NLIB) $(RESLIB)
nameif: $(NET_LIB) nameif.o nameif: $(NET_LIB) nameif.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ nameif.o $(NLIB) $(RESLIB) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ nameif.o $(NLIB) $(RESLIB)
......
...@@ -17,7 +17,7 @@ Please include the output of "program --version" when reporting bugs. ...@@ -17,7 +17,7 @@ Please include the output of "program --version" when reporting bugs.
Contents: Contents:
README This file. README This file.
README.ipv6 Notes for people hacking IPv6. README.ipv6 Notes for people hacking IPv6.
......
...@@ -34,7 +34,7 @@ make BASEDIR=$RPM_BUILD_ROOT install ...@@ -34,7 +34,7 @@ make BASEDIR=$RPM_BUILD_ROOT install
strip arp ifconfig rarp route slattach plipconfig ipmaddr iptunnel strip arp ifconfig rarp route slattach plipconfig ipmaddr iptunnel
cd ../bin cd ../bin
strip hostname netstat strip hostname netstat
) )
%clean %clean
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
...@@ -92,7 +92,7 @@ rm -rf $RPM_BUILD_ROOT ...@@ -92,7 +92,7 @@ rm -rf $RPM_BUILD_ROOT
* Fri Feb 27 1998 Jason Spangler <jasons@usemail.com> * Fri Feb 27 1998 Jason Spangler <jasons@usemail.com>
- changed to net-tools 1.432 - changed to net-tools 1.432
- removed old glibc 2.1 patch - removed old glibc 2.1 patch
* Wed Oct 22 1997 Erik Troan <ewt@redhat.com> * Wed Oct 22 1997 Erik Troan <ewt@redhat.com>
- added extra patches for glibc 2.1 - added extra patches for glibc 2.1
......
...@@ -23,7 +23,7 @@ TODO for net-tools ...@@ -23,7 +23,7 @@ TODO for net-tools
[ ] supply some informations about new features to HOWTOs [ ] supply some informations about new features to HOWTOs
[ ] Config file only works with bash not ash. [ ] Config file only works with bash not ash.
[ ] Token ring is almost totally untested. [ ] Token ring is almost totally untested.
[ ] additional tools for IPX, AX.25 etc be bundled [ipxripd004, ipx_* tools [ ] additional tools for IPX, AX.25 etc be bundled [ipxripd004, ipx_* tools
from caldera, axattach] into existing bins from caldera, axattach] into existing bins
[ ] "SIOCAX25OPTRT" [Joerg (DL1BKE)]. 1.3.75 [ ] "SIOCAX25OPTRT" [Joerg (DL1BKE)]. 1.3.75
[ ] dummy NOARP?! (2. default route for preveting hostunreachables on linedrop) [ ] dummy NOARP?! (2. default route for preveting hostunreachables on linedrop)
......
...@@ -20,14 +20,14 @@ ...@@ -20,14 +20,14 @@
* Andrew Tridgell : proxy arp netmasks * Andrew Tridgell : proxy arp netmasks
* Bernd Eckenfels : -n option * Bernd Eckenfels : -n option
* Bernd Eckenfels : Use only /proc for display * Bernd Eckenfels : Use only /proc for display
* {1.60} Bernd Eckenfels : new arpcode (-i) for 1.3.42 but works * {1.60} Bernd Eckenfels : new arpcode (-i) for 1.3.42 but works
* with 1.2.x, too * with 1.2.x, too
* {1.61} Bernd Eckenfels : more verbose messages * {1.61} Bernd Eckenfels : more verbose messages
* {1.62} Bernd Eckenfels : check -t for hw adresses and try to * {1.62} Bernd Eckenfels : check -t for hw adresses and try to
* explain EINVAL (jeff) * explain EINVAL (jeff)
*970125 {1.63} Bernd Eckenfels : -a print hardwarename instead of tiltle *970125 {1.63} Bernd Eckenfels : -a print hardwarename instead of tiltle
*970201 {1.64} Bernd Eckenfels : net-features.h support *970201 {1.64} Bernd Eckenfels : net-features.h support
*970203 {1.65} Bernd Eckenfels : "#define" in "#if", *970203 {1.65} Bernd Eckenfels : "#define" in "#if",
* -H|-A additional to -t|-p * -H|-A additional to -t|-p
*970214 {1.66} Bernd Eckenfels : Fix optarg required for -H and -A *970214 {1.66} Bernd Eckenfels : Fix optarg required for -H and -A
*970412 {1.67} Bernd Eckenfels : device=""; is default *970412 {1.67} Bernd Eckenfels : device=""; is default
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
*970517 {1.69} Bernd Eckenfels : usage() fixed *970517 {1.69} Bernd Eckenfels : usage() fixed
*970622 {1.70} Bernd Eckenfels : arp -d priv *970622 {1.70} Bernd Eckenfels : arp -d priv
*970106 {1.80} Bernd Eckenfels : new syntax without -D and with "dev <If>", *970106 {1.80} Bernd Eckenfels : new syntax without -D and with "dev <If>",
* ATF_MAGIC, ATF_DONTPUB support. * ATF_MAGIC, ATF_DONTPUB support.
* Typo fix (Debian Bug#5728 Giuliano Procida) * Typo fix (Debian Bug#5728 Giuliano Procida)
*970803 {1.81} Bernd Eckenfels : removed junk comment line 1 *970803 {1.81} Bernd Eckenfels : removed junk comment line 1
*970925 {1.82} Bernd Eckenfels : include fix for libc6 *970925 {1.82} Bernd Eckenfels : include fix for libc6
...@@ -628,7 +628,7 @@ static void usage(void) ...@@ -628,7 +628,7 @@ static void usage(void)
fprintf(stderr, _(" arp [-vnD] [<HW>] [-i <if>] -f [<filename>] <-Add entry from file\n")); fprintf(stderr, _(" arp [-vnD] [<HW>] [-i <if>] -f [<filename>] <-Add entry from file\n"));
fprintf(stderr, _(" arp [-v] [<HW>] [-i <if>] -s <host> <hwaddr> [temp] <-Add entry\n")); fprintf(stderr, _(" arp [-v] [<HW>] [-i <if>] -s <host> <hwaddr> [temp] <-Add entry\n"));
fprintf(stderr, _(" arp [-v] [<HW>] [-i <if>] -Ds <host> <if> [netmask <nm>] pub <-''-\n\n")); fprintf(stderr, _(" arp [-v] [<HW>] [-i <if>] -Ds <host> <if> [netmask <nm>] pub <-''-\n\n"));
fprintf(stderr, _(" -a display (all) hosts in alternative (BSD) style\n")); fprintf(stderr, _(" -a display (all) hosts in alternative (BSD) style\n"));
fprintf(stderr, _(" -e display (all) hosts in default (Linux) style\n")); fprintf(stderr, _(" -e display (all) hosts in default (Linux) style\n"));
fprintf(stderr, _(" -s, --set set a new ARP entry\n")); fprintf(stderr, _(" -s, --set set a new ARP entry\n"));
......
...@@ -46,7 +46,7 @@ bool 'Does your system support GNU gettext?' I18N n ...@@ -46,7 +46,7 @@ bool 'Does your system support GNU gettext?' I18N n
* *
* *
* Protocol Families. * Protocol Families.
* *
bool 'UNIX protocol family' HAVE_AFUNIX y bool 'UNIX protocol family' HAVE_AFUNIX y
bool 'INET (TCP/IP) protocol family' HAVE_AFINET y bool 'INET (TCP/IP) protocol family' HAVE_AFINET y
bool 'INET6 (IPv6) protocol family' HAVE_AFINET6 y bool 'INET6 (IPv6) protocol family' HAVE_AFINET6 y
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Usage: hostname [-d|-f|-s|-a|-i|-y|-n] * Usage: hostname [-d|-f|-s|-a|-i|-y|-n]
* hostname [-h|-V] * hostname [-h|-V]
* hostname {name|-F file} * hostname {name|-F file}
* dnsdmoainname * dnsdmoainname
* nisdomainname {name|-F file} * nisdomainname {name|-F file}
* *
* Version: hostname 1.101 (2003-10-11) * Version: hostname 1.101 (2003-10-11)
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* Changes: * Changes:
* {1.90} Peter Tobias : Added -a and -i options. * {1.90} Peter Tobias : Added -a and -i options.
* {1.91} Bernd Eckenfels : -v,-V rewritten, long_opts (major rewrite), usage. * {1.91} Bernd Eckenfels : -v,-V rewritten, long_opts (major rewrite), usage.
*19960120 {1.95} Bernd Eckenfels : -y/nisdomainname - support for get/setdomainname added *19960120 {1.95} Bernd Eckenfels : -y/nisdomainname - support for get/setdomainname added
*19960218 {1.96} Bernd Eckenfels : netinet/in.h added *19960218 {1.96} Bernd Eckenfels : netinet/in.h added
*19980629 {1.97} Arnaldo Carvalho de Melo : gettext instead of catgets for i18n *19980629 {1.97} Arnaldo Carvalho de Melo : gettext instead of catgets for i18n
*20000213 {1.99} Arnaldo Carvalho de Melo : fixed some i18n strings *20000213 {1.99} Arnaldo Carvalho de Melo : fixed some i18n strings
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
* *
* {1.34} - 19980630 - Arnaldo Carvalho de Melo <acme@conectiva.com.br> * {1.34} - 19980630 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* - gettext instead of catgets for i18n * - gettext instead of catgets for i18n
* 10/1998 - Andi Kleen. Use interface list primitives. * 10/1998 - Andi Kleen. Use interface list primitives.
* 20001008 - Bernd Eckenfels, Patch from RH for setting mtu * 20001008 - Bernd Eckenfels, Patch from RH for setting mtu
* (default AF was wrong) * (default AF was wrong)
* 20010404 - Arnaldo Carvalho de Melo, use setlocale * 20010404 - Arnaldo Carvalho de Melo, use setlocale
*/ */
...@@ -93,7 +93,7 @@ int opt_v = 0; /* debugging output flag */ ...@@ -93,7 +93,7 @@ int opt_v = 0; /* debugging output flag */
int addr_family = 0; /* currently selected AF */ int addr_family = 0; /* currently selected AF */
/* for ipv4 add/del modes */ /* for ipv4 add/del modes */
static int get_nmbc_parent(char *parent, unsigned long *nm, static int get_nmbc_parent(char *parent, unsigned long *nm,
unsigned long *bc); unsigned long *bc);
static int set_ifstate(char *parent, unsigned long ip, static int set_ifstate(char *parent, unsigned long ip,
unsigned long nm, unsigned long bc, unsigned long nm, unsigned long bc,
...@@ -115,11 +115,11 @@ static int if_print(char *ifname) ...@@ -115,11 +115,11 @@ static int if_print(char *ifname)
if (!ife) { if (!ife) {
return -1; return -1;
} }
res = do_if_fetch(ife); res = do_if_fetch(ife);
if (res >= 0) if (res >= 0)
ife_print(ife); ife_print(ife);
} }
return res; return res;
} }
/* Set a certain interface flag. */ /* Set a certain interface flag. */
...@@ -129,7 +129,7 @@ static int set_flag(char *ifname, short flag) ...@@ -129,7 +129,7 @@ static int set_flag(char *ifname, short flag)
safe_strncpy(ifr.ifr_name, ifname, IFNAMSIZ); safe_strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(skfd, SIOCGIFFLAGS, &ifr) < 0) { if (ioctl(skfd, SIOCGIFFLAGS, &ifr) < 0) {
fprintf(stderr, _("%s: ERROR while getting interface flags: %s\n"), fprintf(stderr, _("%s: ERROR while getting interface flags: %s\n"),
ifname, strerror(errno)); ifname, strerror(errno));
return (-1); return (-1);
} }
...@@ -161,7 +161,7 @@ static int clr_flag(char *ifname, short flag) ...@@ -161,7 +161,7 @@ static int clr_flag(char *ifname, short flag)
safe_strncpy(ifr.ifr_name, ifname, IFNAMSIZ); safe_strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
fprintf(stderr, _("%s: ERROR while getting interface flags: %s\n"), fprintf(stderr, _("%s: ERROR while getting interface flags: %s\n"),
ifname, strerror(errno)); ifname, strerror(errno));
return -1; return -1;
} }
...@@ -193,7 +193,7 @@ static int test_flag(char *ifname, short flags) ...@@ -193,7 +193,7 @@ static int test_flag(char *ifname, short flags)
safe_strncpy(ifr.ifr_name, ifname, IFNAMSIZ); safe_strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
fprintf(stderr, _("%s: ERROR while testing interface flags: %s\n"), fprintf(stderr, _("%s: ERROR while testing interface flags: %s\n"),
ifname, strerror(errno)); ifname, strerror(errno));
return -1; return -1;
} }
...@@ -277,7 +277,7 @@ int main(int argc, char **argv) ...@@ -277,7 +277,7 @@ int main(int argc, char **argv)
#endif #endif
#if I18N #if I18N
setlocale (LC_ALL, ""); setlocale(LC_ALL, "");
bindtextdomain("net-tools", "/usr/share/locale"); bindtextdomain("net-tools", "/usr/share/locale");
textdomain("net-tools"); textdomain("net-tools");
#endif #endif
...@@ -294,7 +294,7 @@ int main(int argc, char **argv) ...@@ -294,7 +294,7 @@ int main(int argc, char **argv)
else if (!strcmp(*argv, "-v")) else if (!strcmp(*argv, "-v"))
opt_v = 1; opt_v = 1;
else if (!strcmp(*argv, "-V") || !strcmp(*argv, "-version") || else if (!strcmp(*argv, "-V") || !strcmp(*argv, "-version") ||
!strcmp(*argv, "--version")) !strcmp(*argv, "--version"))
version(); version();
...@@ -304,7 +304,7 @@ int main(int argc, char **argv) ...@@ -304,7 +304,7 @@ int main(int argc, char **argv)
usage(); usage();
else { else {
fprintf(stderr, _("ifconfig: option `%s' not recognised.\n"), fprintf(stderr, _("ifconfig: option `%s' not recognised.\n"),
argv[0]); argv[0]);
fprintf(stderr, _("ifconfig: `--help' gives usage information.\n")); fprintf(stderr, _("ifconfig: `--help' gives usage information.\n"));
exit(1); exit(1);
...@@ -338,9 +338,9 @@ int main(int argc, char **argv) ...@@ -338,9 +338,9 @@ int main(int argc, char **argv)
/* The next argument is either an address family name, or an option. */ /* The next argument is either an address family name, or an option. */
if ((ap = get_aftype(*spp)) != NULL) if ((ap = get_aftype(*spp)) != NULL)
spp++; /* it was a AF name */ spp++; /* it was a AF name */
else else
ap = get_aftype(DFLT_AF); ap = get_aftype(DFLT_AF);
if (ap) { if (ap) {
addr_family = ap->af; addr_family = ap->af;
skfd = ap->fd; skfd = ap->fd;
...@@ -385,7 +385,7 @@ int main(int argc, char **argv) ...@@ -385,7 +385,7 @@ int main(int argc, char **argv)
goterr = 1; goterr = 1;
} else { } else {
if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0) { if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0) {
perror("port: SIOCGIFMAP"); perror("port: SIOCGIFMAP");
goterr = 1; goterr = 1;
continue; continue;
} }
...@@ -600,8 +600,8 @@ int main(int argc, char **argv) ...@@ -600,8 +600,8 @@ int main(int argc, char **argv)
if (*++spp == NULL) if (*++spp == NULL)
usage(); usage();
if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0) { if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0) {
fprintf(stderr, "mem_start: SIOCGIFMAP: %s\n", strerror(errno)); fprintf(stderr, "mem_start: SIOCGIFMAP: %s\n", strerror(errno));
spp++; spp++;
goterr = 1; goterr = 1;
continue; continue;
} }
...@@ -617,8 +617,8 @@ int main(int argc, char **argv) ...@@ -617,8 +617,8 @@ int main(int argc, char **argv)
if (*++spp == NULL) if (*++spp == NULL)
usage(); usage();
if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0) { if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0) {
fprintf(stderr, "io_addr: SIOCGIFMAP: %s\n", strerror(errno)); fprintf(stderr, "io_addr: SIOCGIFMAP: %s\n", strerror(errno));
spp++; spp++;
goterr = 1; goterr = 1;
continue; continue;
} }
...@@ -634,9 +634,9 @@ int main(int argc, char **argv) ...@@ -634,9 +634,9 @@ int main(int argc, char **argv)
if (*++spp == NULL) if (*++spp == NULL)
usage(); usage();
if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0) { if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0) {
fprintf(stderr, "irq: SIOCGIFMAP: %s\n", strerror(errno)); fprintf(stderr, "irq: SIOCGIFMAP: %s\n", strerror(errno));
goterr = 1; goterr = 1;
spp++; spp++;
continue; continue;
} }
ifr.ifr_map.irq = atoi(*spp); ifr.ifr_map.irq = atoi(*spp);
...@@ -730,7 +730,7 @@ int main(int argc, char **argv) ...@@ -730,7 +730,7 @@ int main(int argc, char **argv)
prefix_len = 128; prefix_len = 128;
} }
safe_strncpy(host, *spp, (sizeof host)); safe_strncpy(host, *spp, (sizeof host));
if (inet6_aftype.input(1, host, if (inet6_aftype.input(1, host,
(struct sockaddr *) &sa6) < 0) { (struct sockaddr *) &sa6) < 0) {
if (inet6_aftype.herror) if (inet6_aftype.herror)
inet6_aftype.herror(host); inet6_aftype.herror(host);
...@@ -745,7 +745,7 @@ int main(int argc, char **argv) ...@@ -745,7 +745,7 @@ int main(int argc, char **argv)
fd = get_socket_for_af(AF_INET6); fd = get_socket_for_af(AF_INET6);
if (fd < 0) { if (fd < 0) {
fprintf(stderr, fprintf(stderr,
_("No support for INET6 on this system.\n")); _("No support for INET6 on this system.\n"));
goterr = 1; goterr = 1;
spp++; spp++;
...@@ -779,7 +779,7 @@ int main(int argc, char **argv) ...@@ -779,7 +779,7 @@ int main(int argc, char **argv)
} }
fd = get_socket_for_af(AF_INET); fd = get_socket_for_af(AF_INET);
if (fd < 0) { if (fd < 0) {
fprintf(stderr, fprintf(stderr,
_("No support for INET on this system.\n")); _("No support for INET on this system.\n"));
goterr = 1; goterr = 1;
spp++; spp++;
...@@ -787,7 +787,7 @@ int main(int argc, char **argv) ...@@ -787,7 +787,7 @@ int main(int argc, char **argv)
} }
memcpy(&ip, &sin.sin_addr.s_addr, sizeof(unsigned long)); memcpy(&ip, &sin.sin_addr.s_addr, sizeof(unsigned long));
if (get_nmbc_parent(ifr.ifr_name, &nm, &bc) < 0) { if (get_nmbc_parent(ifr.ifr_name, &nm, &bc) < 0) {
fprintf(stderr, _("Interface %s not initialized\n"), fprintf(stderr, _("Interface %s not initialized\n"),
ifr.ifr_name); ifr.ifr_name);
...@@ -796,7 +796,7 @@ int main(int argc, char **argv) ...@@ -796,7 +796,7 @@ int main(int argc, char **argv)
continue; continue;
} }
set_ifstate(ifr.ifr_name, ip, nm, bc, 1); set_ifstate(ifr.ifr_name, ip, nm, bc, 1);
} }
spp++; spp++;
continue; continue;
...@@ -823,7 +823,7 @@ int main(int argc, char **argv) ...@@ -823,7 +823,7 @@ int main(int argc, char **argv)
prefix_len = 128; prefix_len = 128;
} }
safe_strncpy(host, *spp, (sizeof host)); safe_strncpy(host, *spp, (sizeof host));
if (inet6_aftype.input(1, host, if (inet6_aftype.input(1, host,
(struct sockaddr *) &sa6) < 0) { (struct sockaddr *) &sa6) < 0) {
inet6_aftype.herror(host); inet6_aftype.herror(host);
goterr = 1; goterr = 1;
...@@ -832,10 +832,10 @@ int main(int argc, char **argv) ...@@ -832,10 +832,10 @@ int main(int argc, char **argv)
} }
memcpy((char *) &ifr6.ifr6_addr, (char *) &sa6.sin6_addr, memcpy((char *) &ifr6.ifr6_addr, (char *) &sa6.sin6_addr,
sizeof(struct in6_addr)); sizeof(struct in6_addr));
fd = get_socket_for_af(AF_INET6); fd = get_socket_for_af(AF_INET6);
if (fd < 0) { if (fd < 0) {
fprintf(stderr, fprintf(stderr,
_("No support for INET6 on this system.\n")); _("No support for INET6 on this system.\n"));
goterr = 1; goterr = 1;
spp++; spp++;
...@@ -878,11 +878,11 @@ int main(int argc, char **argv) ...@@ -878,11 +878,11 @@ int main(int argc, char **argv)
spp++; spp++;
continue; continue;
} }
/* Clear "ip" in case sizeof(unsigned long) > sizeof(sin.sin_addr.s_addr) */ /* Clear "ip" in case sizeof(unsigned long) > sizeof(sin.sin_addr.s_addr) */
ip = 0; ip = 0;
memcpy(&ip, &sin.sin_addr.s_addr, sizeof(sin.sin_addr.s_addr)); memcpy(&ip, &sin.sin_addr.s_addr, sizeof(sin.sin_addr.s_addr));
if (get_nmbc_parent(ifr.ifr_name, &nm, &bc) < 0) { if (get_nmbc_parent(ifr.ifr_name, &nm, &bc) < 0) {
fprintf(stderr, _("Interface %s not initialized\n"), fprintf(stderr, _("Interface %s not initialized\n"),
ifr.ifr_name); ifr.ifr_name);
...@@ -953,7 +953,7 @@ int main(int argc, char **argv) ...@@ -953,7 +953,7 @@ int main(int argc, char **argv)
/* If the next argument is a valid hostname, assume OK. */ /* If the next argument is a valid hostname, assume OK. */
safe_strncpy(host, *spp, (sizeof host)); safe_strncpy(host, *spp, (sizeof host));
/* FIXME: sa is too small for INET6 addresses, inet6 should use that too, /* FIXME: sa is too small for INET6 addresses, inet6 should use that too,
broadcast is unexpected */ broadcast is unexpected */
if (ap->getmask) { if (ap->getmask) {
switch (ap->getmask(host, &samask, NULL)) { switch (ap->getmask(host, &samask, NULL)) {
...@@ -1020,14 +1020,14 @@ int main(int argc, char **argv) ...@@ -1020,14 +1020,14 @@ int main(int argc, char **argv)
* end, since it's deleted already! - Roman * end, since it's deleted already! - Roman
* *
* Should really use regex.h here, not sure though how well it'll go * Should really use regex.h here, not sure though how well it'll go
* with the cross-platform support etc. * with the cross-platform support etc.
*/ */
{ {
char *ptr; char *ptr;
short int found_colon = 0; short int found_colon = 0;
for (ptr = ifr.ifr_name; *ptr; ptr++ ) for (ptr = ifr.ifr_name; *ptr; ptr++ )
if (*ptr == ':') found_colon++; if (*ptr == ':') found_colon++;
if (!(found_colon && *(ptr - 1) == '-')) if (!(found_colon && *(ptr - 1) == '-'))
goterr |= set_flag(ifr.ifr_name, (IFF_UP | IFF_RUNNING)); goterr |= set_flag(ifr.ifr_name, (IFF_UP | IFF_RUNNING));
} }
...@@ -1075,7 +1075,7 @@ static int do_ifcmd(struct interface *x, struct ifcmd *ptr) ...@@ -1075,7 +1075,7 @@ static int do_ifcmd(struct interface *x, struct ifcmd *ptr)
char *z, *e; char *z, *e;
struct sockaddr_in *sin; struct sockaddr_in *sin;
int i; int i;
if (do_if_fetch(x) < 0) if (do_if_fetch(x) < 0)
return 0; return 0;
if (strncmp(x->name, ptr->base, ptr->baselen) != 0) if (strncmp(x->name, ptr->base, ptr->baselen) != 0)
...@@ -1091,13 +1091,13 @@ static int do_ifcmd(struct interface *x, struct ifcmd *ptr) ...@@ -1091,13 +1091,13 @@ static int do_ifcmd(struct interface *x, struct ifcmd *ptr)
if (i < 0 || i > 255) if (i < 0 || i > 255)
abort(); abort();
searcher[i] = 1; searcher[i] = 1;
/* copy */ /* copy */
sin = (struct sockaddr_in *)&x->dstaddr; sin = (struct sockaddr_in *)&x->dstaddr;
if (sin->sin_addr.s_addr != ptr->addr) { if (sin->sin_addr.s_addr != ptr->addr) {
return 0; return 0;
} }
if (ptr->flag) { if (ptr->flag) {
/* turn UP */ /* turn UP */
if (set_flag(x->name, IFF_UP | IFF_RUNNING) == -1) if (set_flag(x->name, IFF_UP | IFF_RUNNING) == -1)
...@@ -1107,7 +1107,7 @@ static int do_ifcmd(struct interface *x, struct ifcmd *ptr) ...@@ -1107,7 +1107,7 @@ static int do_ifcmd(struct interface *x, struct ifcmd *ptr)
if (clr_flag(x->name, IFF_UP) == -1) if (clr_flag(x->name, IFF_UP) == -1)
return -1; return -1;
} }
return 1; /* all done! */ return 1; /* all done! */
} }
...@@ -1117,7 +1117,7 @@ static int get_nmbc_parent(char *parent, ...@@ -1117,7 +1117,7 @@ static int get_nmbc_parent(char *parent,
{ {
struct interface *i; struct interface *i;
struct sockaddr_in *sin; struct sockaddr_in *sin;
i = lookup_interface(parent); i = lookup_interface(parent);
if (!i) if (!i)
return -1; return -1;
...@@ -1137,19 +1137,19 @@ static int set_ifstate(char *parent, unsigned long ip, ...@@ -1137,19 +1137,19 @@ static int set_ifstate(char *parent, unsigned long ip,
char buf[IFNAMSIZ]; char buf[IFNAMSIZ];
struct ifcmd pt; struct ifcmd pt;
int i; int i;
pt.base = parent; pt.base = parent;
pt.baselen = strlen(parent); pt.baselen = strlen(parent);
pt.addr = ip; pt.addr = ip;
pt.flag = flag; pt.flag = flag;
memset(searcher, 0, sizeof(searcher)); memset(searcher, 0, sizeof(searcher));
i = for_all_interfaces((int (*)(struct interface *,void *))do_ifcmd, i = for_all_interfaces((int (*)(struct interface *,void *))do_ifcmd,
&pt); &pt);
if (i == -1) if (i == -1)
return -1; return -1;
if (i == 1) if (i == 1)
return 0; return 0;
/* add a new interface */ /* add a new interface */
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
if (searcher[i] == 0) if (searcher[i] == 0)
...@@ -1157,7 +1157,7 @@ static int set_ifstate(char *parent, unsigned long ip, ...@@ -1157,7 +1157,7 @@ static int set_ifstate(char *parent, unsigned long ip,
if (i == 256) if (i == 256)
return -1; /* FAILURE!!! out of ip addresses */ return -1; /* FAILURE!!! out of ip addresses */
if (snprintf(buf, IFNAMSIZ, "%s:%d", parent, i) > IFNAMSIZ) if (snprintf(buf, IFNAMSIZ, "%s:%d", parent, i) > IFNAMSIZ)
return -1; return -1;
if (set_ip_using(buf, SIOCSIFADDR, ip) == -1) if (set_ip_using(buf, SIOCSIFADDR, ip) == -1)
......
...@@ -28,7 +28,7 @@ struct user_net_device_stats { ...@@ -28,7 +28,7 @@ struct user_net_device_stats {
}; };
struct interface { struct interface {
struct interface *next, *prev; struct interface *next, *prev;
char name[IFNAMSIZ]; /* interface name */ char name[IFNAMSIZ]; /* interface name */
short type; /* if type */ short type; /* if type */
short flags; /* various flags */ short flags; /* various flags */
...@@ -87,7 +87,7 @@ extern const char *if_port_text[][4]; ...@@ -87,7 +87,7 @@ extern const char *if_port_text[][4];
#endif #endif
#if !defined(ifr_qlen) #if !defined(ifr_qlen)
/* Actually it is ifru_ivalue, but that is not present in 2.0 kernel headers */ /* Actually it is ifru_ivalue, but that is not present in 2.0 kernel headers */
#define ifr_qlen ifr_ifru.ifru_mtu #define ifr_qlen ifr_ifru.ifru_mtu
#endif #endif
......
...@@ -400,7 +400,7 @@ int main(int argc, char **argv) ...@@ -400,7 +400,7 @@ int main(int argc, char **argv)
basename = argv[0]; basename = argv[0];
else else
basename++; basename++;
while (argc > 1) { while (argc > 1) {
if (argv[1][0] != '-') if (argv[1][0] != '-')
break; break;
......
...@@ -376,7 +376,7 @@ static int do_add(int cmd, int argc, char **argv) ...@@ -376,7 +376,7 @@ static int do_add(int cmd, int argc, char **argv)
return do_add_ioctl(cmd, "gre0", &p); return do_add_ioctl(cmd, "gre0", &p);
case IPPROTO_IPV6: case IPPROTO_IPV6:
return do_add_ioctl(cmd, "sit0", &p); return do_add_ioctl(cmd, "sit0", &p);
default: default:
fprintf(stderr, _("cannot determine tunnel mode (ipip, gre or sit)\n")); fprintf(stderr, _("cannot determine tunnel mode (ipip, gre or sit)\n"));
return -1; return -1;
} }
...@@ -391,13 +391,13 @@ int do_del(int argc, char **argv) ...@@ -391,13 +391,13 @@ int do_del(int argc, char **argv)
return -1; return -1;
switch (p.iph.protocol) { switch (p.iph.protocol) {
case IPPROTO_IPIP: case IPPROTO_IPIP:
return do_del_ioctl(p.name[0] ? p.name : "tunl0", &p); return do_del_ioctl(p.name[0] ? p.name : "tunl0", &p);
case IPPROTO_GRE: case IPPROTO_GRE:
return do_del_ioctl(p.name[0] ? p.name : "gre0", &p); return do_del_ioctl(p.name[0] ? p.name : "gre0", &p);
case IPPROTO_IPV6: case IPPROTO_IPV6:
return do_del_ioctl(p.name[0] ? p.name : "sit0", &p); return do_del_ioctl(p.name[0] ? p.name : "sit0", &p);
default: default:
return do_del_ioctl(p.name, &p); return do_del_ioctl(p.name, &p);
} }
return -1; return -1;
...@@ -538,7 +538,7 @@ static int do_show(int argc, char **argv) ...@@ -538,7 +538,7 @@ static int do_show(int argc, char **argv)
return -1; return -1;
switch (p.iph.protocol) { switch (p.iph.protocol) {
case IPPROTO_IPIP: case IPPROTO_IPIP:
err = do_get_ioctl(p.name[0] ? p.name : "tunl0", &p); err = do_get_ioctl(p.name[0] ? p.name : "tunl0", &p);
break; break;
case IPPROTO_GRE: case IPPROTO_GRE:
...@@ -597,7 +597,7 @@ int main(int argc, char **argv) ...@@ -597,7 +597,7 @@ int main(int argc, char **argv)
basename = argv[0]; basename = argv[0];
else else
basename++; basename++;
while (argc > 1) { while (argc > 1) {
if (argv[1][0] != '-') if (argv[1][0] != '-')
break; break;
......
...@@ -342,7 +342,7 @@ void print_aflist(int type) { ...@@ -342,7 +342,7 @@ void print_aflist(int type) {
if ((type == 1 && ((*afp)->rprint == NULL)) || ((*afp)->af == 0)) { if ((type == 1 && ((*afp)->rprint == NULL)) || ((*afp)->af == 0)) {
afp++; continue; afp++; continue;
} }
if ((count % 3) == 0) fprintf(stderr,count?"\n ":" "); if ((count % 3) == 0) fprintf(stderr,count?"\n ":" ");
txt = (*afp)->name; if (!txt) txt = ".."; txt = (*afp)->name; if (!txt) txt = "..";
fprintf(stderr,"%s (%s) ",txt,(*afp)->title); fprintf(stderr,"%s (%s) ",txt,(*afp)->title);
count++; count++;
......
...@@ -57,7 +57,7 @@ pr_ash(const char *ptr) ...@@ -57,7 +57,7 @@ pr_ash(const char *ptr)
struct hwtype ash_hwtype; struct hwtype ash_hwtype;
static int static int
in_ash(char *bufp, struct sockaddr *sap) in_ash(char *bufp, struct sockaddr *sap)
{ {
char *ptr; char *ptr;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* lib/ddp_gr.c Prinbting of DDP (AppleTalk) routing table * lib/ddp_gr.c Prinbting of DDP (AppleTalk) routing table
* used by the NET-LIB. * used by the NET-LIB.
* *
* NET-LIB * NET-LIB
* *
* Version: $Id: ddp_gr.c,v 1.4 2002/06/02 05:25:15 ecki Exp $ * Version: $Id: ddp_gr.c,v 1.4 2002/06/02 05:25:15 ecki Exp $
* *
...@@ -87,7 +87,7 @@ int DDP_rprint(int options) ...@@ -87,7 +87,7 @@ int DDP_rprint(int options)
} }
fclose(fp); fclose(fp);
return 0; return 0;
} }
......
...@@ -54,7 +54,7 @@ ec_sprint(struct sockaddr *sap, int numeric) ...@@ -54,7 +54,7 @@ ec_sprint(struct sockaddr *sap, int numeric)
return ec_print((const char *) &sec->addr); return ec_print((const char *) &sec->addr);
} }
static int static int
ec_input(int type, char *bufp, struct sockaddr *sap) ec_input(int type, char *bufp, struct sockaddr *sap)
{ {
struct sockaddr_ec *sec = (struct sockaddr_ec *) sap; struct sockaddr_ec *sec = (struct sockaddr_ec *) sap;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Author: Daniel Stodden <stodden@in.tum.de> * Author: Daniel Stodden <stodden@in.tum.de>
* Copyright 2001 Daniel Stodden * Copyright 2001 Daniel Stodden
* *
* blueprinted from ether.c * blueprinted from ether.c
* Copyright 1993 MicroWalt Corporation * Copyright 1993 MicroWalt Corporation
* *
* This program is free software; you can redistribute it * This program is free software; you can redistribute it
...@@ -54,7 +54,7 @@ static const char *pr_eui64(const char *ptr) ...@@ -54,7 +54,7 @@ static const char *pr_eui64(const char *ptr)
static char buff[64]; static char buff[64];
snprintf(buff, sizeof(buff), "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", snprintf(buff, sizeof(buff), "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
(ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377), (ptr[3] & 0377), (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377), (ptr[3] & 0377),
(ptr[4] & 0377), (ptr[5] & 0377), (ptr[6] & 0377), (ptr[7] & 0377) (ptr[4] & 0377), (ptr[5] & 0377), (ptr[6] & 0377), (ptr[7] & 0377)
); );
return (buff); return (buff);
...@@ -79,7 +79,7 @@ static int in_eui64( char *bufp, struct sockaddr *sap ) ...@@ -79,7 +79,7 @@ static int in_eui64( char *bufp, struct sockaddr *sap )
i = 0; i = 0;
orig = bufp; orig = bufp;
while ((*bufp != '\0') && (i < EUI64_ALEN)) { while ((*bufp != '\0') && (i < EUI64_ALEN)) {
val = 0; val = 0;
c = *bufp++; c = *bufp++;
...@@ -120,7 +120,7 @@ static int in_eui64( char *bufp, struct sockaddr *sap ) ...@@ -120,7 +120,7 @@ static int in_eui64( char *bufp, struct sockaddr *sap )
*ptr++ = (unsigned char) (val & 0377); *ptr++ = (unsigned char) (val & 0377);
i++; i++;
/* We might get a semicolon here - not required. */ /* We might get a semicolon here - not required. */
if (*bufp == ':') { if (*bufp == ':') {
if (_DEBUG && i == EUI64_ALEN) if (_DEBUG && i == EUI64_ALEN)
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
/* Split the input string into multiple fields. */ /* Split the input string into multiple fields. */
int getargs(char *string, char *arguments[]) int getargs(char *string, char *arguments[])
{ {
int len = strlen(string); int len = strlen(string);
char temp[len+1]; char temp[len+1];
char *sp, *ptr; char *sp, *ptr;
int i, argc; int i, argc;
......
/* /*
* lib/hdlclapb.c * lib/hdlclapb.c
* This file contains the HDLC/LAPB support for the NET-2 base * This file contains the HDLC/LAPB support for the NET-2 base
* distribution. * distribution.
* *
* Version: $Id: hdlclapb.c,v 1.5 2000/03/05 11:26:02 philip Exp $ * Version: $Id: hdlclapb.c,v 1.5 2000/03/05 11:26:02 philip Exp $
* *
* Original Author: * Original Author:
* Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* Copyright 1993 MicroWalt Corporation * Copyright 1993 MicroWalt Corporation
* *
......
...@@ -101,7 +101,7 @@ static struct hwtype *hwtypes[] = ...@@ -101,7 +101,7 @@ static struct hwtype *hwtypes[] =
#if HAVE_HWTR #if HAVE_HWTR
&tr_hwtype, &tr_hwtype,
#ifdef ARPHRD_IEEE802_TR #ifdef ARPHRD_IEEE802_TR
&tr_hwtype1, &tr_hwtype1,
#endif #endif
#endif #endif
#if HAVE_HWAX25 #if HAVE_HWAX25
...@@ -221,7 +221,7 @@ void hwinit() ...@@ -221,7 +221,7 @@ void hwinit()
#if HAVE_HWTR #if HAVE_HWTR
tr_hwtype.title = _("16/4 Mbps Token Ring"); tr_hwtype.title = _("16/4 Mbps Token Ring");
#ifdef ARPHRD_IEEE802_TR #ifdef ARPHRD_IEEE802_TR
tr_hwtype1.title = _("16/4 Mbps Token Ring (New)") ; tr_hwtype1.title = _("16/4 Mbps Token Ring (New)") ;
#endif #endif
#endif #endif
#if HAVE_HWEC #if HAVE_HWEC
...@@ -285,7 +285,7 @@ void print_hwlist(int type) { ...@@ -285,7 +285,7 @@ void print_hwlist(int type) {
if (((type == 1) && ((*hwp)->alen == 0)) || ((*hwp)->type == -1)) { if (((type == 1) && ((*hwp)->alen == 0)) || ((*hwp)->type == -1)) {
hwp++; continue; hwp++; continue;
} }
if ((count % 3) == 0) fprintf(stderr,count?"\n ":" "); if ((count % 3) == 0) fprintf(stderr,count?"\n ":" ");
txt = (*hwp)->name; if (!txt) txt = ".."; txt = (*hwp)->name; if (!txt) txt = "..";
fprintf(stderr,"%s (%s) ",txt,(*hwp)->title); fprintf(stderr,"%s (%s) ",txt,(*hwp)->title);
count++; count++;
......
...@@ -14,11 +14,11 @@ ...@@ -14,11 +14,11 @@
*960203 {1.23} Bernd Eckenfels : net-features support *960203 {1.23} Bernd Eckenfels : net-features support
*960217 {1.24} Bernd Eckenfels : get_sname *960217 {1.24} Bernd Eckenfels : get_sname
*960219 {1.25} Bernd Eckenfels : extern int h_errno *960219 {1.25} Bernd Eckenfels : extern int h_errno
*960329 {1.26} Bernd Eckenfels : resolve 255.255.255.255 *960329 {1.26} Bernd Eckenfels : resolve 255.255.255.255
*980101 {1.27} Bernd Eckenfels : resolve raw sockets in /etc/protocols *980101 {1.27} Bernd Eckenfels : resolve raw sockets in /etc/protocols
*990302 {1.28} Phil Blundell : add netmask to INET_rresolve *990302 {1.28} Phil Blundell : add netmask to INET_rresolve
*991007 Kurt Garloff : rresolve, resolve: may be hosts *991007 Kurt Garloff : rresolve, resolve: may be hosts
* <garloff@suse.de> store type (host?) in cache * <garloff@suse.de> store type (host?) in cache
* *
* This program is free software; you can redistribute it * This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General * and/or modify it under the terms of the GNU General
...@@ -96,9 +96,9 @@ static int INET_resolve(char *name, struct sockaddr_in *sin, int hostfirst) ...@@ -96,9 +96,9 @@ static int INET_resolve(char *name, struct sockaddr_in *sin, int hostfirst)
#ifdef DEBUG #ifdef DEBUG
if (hostfirst) fprintf (stderr, "gethostbyname (%s)\n", name); if (hostfirst) fprintf (stderr, "gethostbyname (%s)\n", name);
#endif #endif
if (hostfirst && if (hostfirst &&
(hp = gethostbyname(name)) != (struct hostent *) NULL) { (hp = gethostbyname(name)) != (struct hostent *) NULL) {
memcpy((char *) &sin->sin_addr, (char *) hp->h_addr_list[0], memcpy((char *) &sin->sin_addr, (char *) hp->h_addr_list[0],
sizeof(struct in_addr)); sizeof(struct in_addr));
return 0; return 0;
} }
...@@ -127,18 +127,18 @@ static int INET_resolve(char *name, struct sockaddr_in *sin, int hostfirst) ...@@ -127,18 +127,18 @@ static int INET_resolve(char *name, struct sockaddr_in *sin, int hostfirst)
errno = h_errno; errno = h_errno;
return -1; return -1;
} }
memcpy((char *) &sin->sin_addr, (char *) hp->h_addr_list[0], memcpy((char *) &sin->sin_addr, (char *) hp->h_addr_list[0],
sizeof(struct in_addr)); sizeof(struct in_addr));
return 0; return 0;
} }
/* numeric: & 0x8000: default instead of *, /* numeric: & 0x8000: default instead of *,
* & 0x4000: host instead of net, * & 0x4000: host instead of net,
* & 0x0fff: don't resolve * & 0x0fff: don't resolve
*/ */
static int INET_rresolve(char *name, size_t len, struct sockaddr_in *sin, static int INET_rresolve(char *name, size_t len, struct sockaddr_in *sin,
int numeric, unsigned int netmask) int numeric, unsigned int netmask)
{ {
struct hostent *ent; struct hostent *ent;
...@@ -243,21 +243,21 @@ static const char *INET_sprint(struct sockaddr *sap, int numeric) ...@@ -243,21 +243,21 @@ static const char *INET_sprint(struct sockaddr *sap, int numeric)
if (sap->sa_family == 0xFFFF || sap->sa_family == 0) if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
return safe_strncpy(buff, _("[NONE SET]"), sizeof(buff)); return safe_strncpy(buff, _("[NONE SET]"), sizeof(buff));
if (INET_rresolve(buff, sizeof(buff), (struct sockaddr_in *) sap, if (INET_rresolve(buff, sizeof(buff), (struct sockaddr_in *) sap,
numeric, 0xffffff00) != 0) numeric, 0xffffff00) != 0)
return (NULL); return (NULL);
return (buff); return (buff);
} }
char *INET_sprintmask(struct sockaddr *sap, int numeric, char *INET_sprintmask(struct sockaddr *sap, int numeric,
unsigned int netmask) unsigned int netmask)
{ {
static char buff[128]; static char buff[128];
if (sap->sa_family == 0xFFFF || sap->sa_family == 0) if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
return safe_strncpy(buff, _("[NONE SET]"), sizeof(buff)); return safe_strncpy(buff, _("[NONE SET]"), sizeof(buff));
if (INET_rresolve(buff, sizeof(buff), (struct sockaddr_in *) sap, if (INET_rresolve(buff, sizeof(buff), (struct sockaddr_in *) sap,
numeric, netmask) != 0) numeric, netmask) != 0)
return (NULL); return (NULL);
return (buff); return (buff);
......
...@@ -44,20 +44,20 @@ ...@@ -44,20 +44,20 @@
extern int h_errno; /* some netdb.h versions don't export this */ extern int h_errno; /* some netdb.h versions don't export this */
char * fix_v4_address(char *buf, struct in6_addr *in6) char * fix_v4_address(char *buf, struct in6_addr *in6)
{ {
if (IN6_IS_ADDR_V4MAPPED(in6->s6_addr)) { if (IN6_IS_ADDR_V4MAPPED(in6->s6_addr)) {
char *s =strchr(buf, '.'); char *s =strchr(buf, '.');
if (s) { if (s) {
while (s > buf && *s != ':') while (s > buf && *s != ':')
--s; --s;
if (*s == ':') ++s; if (*s == ':') ++s;
else s = NULL; else s = NULL;
} }
if (s) return s; if (s) return s;
} }
return buf; return buf;
} }
static int INET6_resolve(char *name, struct sockaddr_in6 *sin6) static int INET6_resolve(char *name, struct sockaddr_in6 *sin6)
{ {
...@@ -163,8 +163,8 @@ static int INET6_getsock(char *bufp, struct sockaddr *sap) ...@@ -163,8 +163,8 @@ static int INET6_getsock(char *bufp, struct sockaddr *sap)
if (inet_pton(AF_INET6, bufp, sin6->sin6_addr.s6_addr) <= 0) if (inet_pton(AF_INET6, bufp, sin6->sin6_addr.s6_addr) <= 0)
return (-1); return (-1);
p = fix_v4_address(bufp, &sin6->sin6_addr); p = fix_v4_address(bufp, &sin6->sin6_addr);
if (p != bufp) if (p != bufp)
memcpy(bufp, p, strlen(p)+1); memcpy(bufp, p, strlen(p)+1);
return 16; /* ?;) */ return 16; /* ?;) */
} }
......
...@@ -63,7 +63,7 @@ int rprint_fib6(int ext, int numeric) ...@@ -63,7 +63,7 @@ int rprint_fib6(int ext, int numeric)
struct sockaddr_in6 saddr6, snaddr6; struct sockaddr_in6 saddr6, snaddr6;
int num, iflags, metric, refcnt, use, prefix_len, slen; int num, iflags, metric, refcnt, use, prefix_len, slen;
FILE *fp = fopen(_PATH_PROCNET_ROUTE6, "r"); FILE *fp = fopen(_PATH_PROCNET_ROUTE6, "r");
char addr6p[8][5], saddr6p[8][5], naddr6p[8][5]; char addr6p[8][5], saddr6p[8][5], naddr6p[8][5];
if (!fp) { if (!fp) {
...@@ -101,7 +101,7 @@ int rprint_fib6(int ext, int numeric) ...@@ -101,7 +101,7 @@ int rprint_fib6(int ext, int numeric)
if (numeric & RTF_CACHE) if (numeric & RTF_CACHE)
continue; continue;
} }
/* Fetch and resolve the target address. */ /* Fetch and resolve the target address. */
snprintf(addr6, sizeof(addr6), "%s:%s:%s:%s:%s:%s:%s:%s", snprintf(addr6, sizeof(addr6), "%s:%s:%s:%s:%s:%s:%s:%s",
addr6p[0], addr6p[1], addr6p[2], addr6p[3], addr6p[0], addr6p[1], addr6p[2], addr6p[3],
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "proc.h" #include "proc.h"
extern struct aftype inet_aftype; extern struct aftype inet_aftype;
extern char *INET_sprintmask(struct sockaddr *sap, int numeric, extern char *INET_sprintmask(struct sockaddr *sap, int numeric,
unsigned int netmask); unsigned int netmask);
int rprint_fib(int ext, int numeric) int rprint_fib(int ext, int numeric)
...@@ -104,9 +104,9 @@ int rprint_fib(int ext, int numeric) ...@@ -104,9 +104,9 @@ int rprint_fib(int ext, int numeric)
/* Fetch and resolve the genmask. */ /* Fetch and resolve the genmask. */
(void) inet_aftype.input(1, mask_addr, &snet_mask); (void) inet_aftype.input(1, mask_addr, &snet_mask);
sin_netmask = (struct sockaddr_in *)&snet_mask; sin_netmask = (struct sockaddr_in *)&snet_mask;
strcpy(net_addr, INET_sprintmask(&snet_target, strcpy(net_addr, INET_sprintmask(&snet_target,
(numeric | 0x8000 | (iflags & RTF_HOST? 0x4000: 0)), (numeric | 0x8000 | (iflags & RTF_HOST? 0x4000: 0)),
sin_netmask->sin_addr.s_addr)); sin_netmask->sin_addr.s_addr));
net_addr[15] = '\0'; net_addr[15] = '\0';
...@@ -221,17 +221,17 @@ int rprint_cache(int ext, int numeric) ...@@ -221,17 +221,17 @@ int rprint_cache(int ext, int numeric)
return 1; return 1;
} }
/* Okay, first thing we need to know is the format of the rt_cache. /* Okay, first thing we need to know is the format of the rt_cache.
* I am aware of two possible layouts: * I am aware of two possible layouts:
* 2.2.0 * 2.2.0
* "Iface\tDestination\tGateway \tFlags\t\tRefCnt\tUse\tMetric\tSource\t\tMTU\tWindow\tIRTT\tTOS\tHHRef\tHHUptod\tSpecDst" * "Iface\tDestination\tGateway \tFlags\t\tRefCnt\tUse\tMetric\tSource\t\tMTU\tWindow\tIRTT\tTOS\tHHRef\tHHUptod\tSpecDst"
* "%s\t%08lX\t%08lX\t%8X\t%d\t%u\t%d\t%08lX\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X" * "%s\t%08lX\t%08lX\t%8X\t%d\t%u\t%d\t%08lX\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X"
* *
* 2.0.36 * 2.0.36
* "Iface\tDestination\tGateway \tFlags\tRefCnt\tUse\tMetric\tSource\t\tMTU\tWindow\tIRTT\tHH\tARP" * "Iface\tDestination\tGateway \tFlags\tRefCnt\tUse\tMetric\tSource\t\tMTU\tWindow\tIRTT\tHH\tARP"
* "%s\t%08lX\t%08lX\t%02X\t%d\t%u\t%d\t%08lX\t%d\t%lu\t%u\t%d\t%1d" * "%s\t%08lX\t%08lX\t%02X\t%d\t%u\t%d\t%08lX\t%d\t%lu\t%u\t%d\t%1d"
*/ */
format = proc_guess_fmt(_PATH_PROCNET_RTCACHE, fp, "IRTT",1,"TOS",2,"HHRef",4,"HHUptod",8,"SpecDst",16,"HH",32,"ARP",64,NULL); format = proc_guess_fmt(_PATH_PROCNET_RTCACHE, fp, "IRTT",1,"TOS",2,"HHRef",4,"HHUptod",8,"SpecDst",16,"HH",32,"ARP",64,NULL);
printf(_("Kernel IP routing cache\n")); printf(_("Kernel IP routing cache\n"));
...@@ -251,7 +251,7 @@ int rprint_cache(int ext, int numeric) ...@@ -251,7 +251,7 @@ int rprint_cache(int ext, int numeric)
printf("ERROR: proc_guess_fmt(%s,... returned: %d\n",_PATH_PROCNET_RTCACHE, format); printf("ERROR: proc_guess_fmt(%s,... returned: %d\n",_PATH_PROCNET_RTCACHE, format);
break; break;
} }
rewind(fp); rewind(fp);
if (ext == 1) if (ext == 1)
...@@ -333,7 +333,7 @@ int rprint_cache(int ext, int numeric) ...@@ -333,7 +333,7 @@ int rprint_cache(int ext, int numeric)
if (num < 12) if (num < 12)
continue; continue;
} }
/* Fetch and resolve the target address. */ /* Fetch and resolve the target address. */
(void) inet_aftype.input(1, dest_addr, &snet); (void) inet_aftype.input(1, dest_addr, &snet);
......
/* Code to manipulate interface information, shared between ifconfig and /* Code to manipulate interface information, shared between ifconfig and
netstat. netstat.
10/1998 partly rewriten by Andi Kleen to support an interface list. 10/1998 partly rewriten by Andi Kleen to support an interface list.
I don't claim that the list operations are efficient @). I don't claim that the list operations are efficient @).
8/2000 Andi Kleen make the list operations a bit more efficient. 8/2000 Andi Kleen make the list operations a bit more efficient.
People are crazy enough to use thousands of aliases now. People are crazy enough to use thousands of aliases now.
...@@ -103,23 +103,23 @@ static struct interface *if_cache_add(char *name) ...@@ -103,23 +103,23 @@ static struct interface *if_cache_add(char *name)
/* the cache is sorted, so if we hit a smaller if, exit */ /* the cache is sorted, so if we hit a smaller if, exit */
for (ife = int_last; ife; ife = ife->prev) { for (ife = int_last; ife; ife = ife->prev) {
int n = nstrcmp(ife->name, name); int n = nstrcmp(ife->name, name);
if (n == 0) if (n == 0)
return ife; return ife;
if (n < 0) if (n < 0)
break; break;
} }
new(new); new(new);
safe_strncpy(new->name, name, IFNAMSIZ); safe_strncpy(new->name, name, IFNAMSIZ);
nextp = ife ? &ife->next : &int_list; // keep sorting nextp = ife ? &ife->next : &int_list; // keep sorting
new->prev = ife; new->prev = ife;
new->next = *nextp; new->next = *nextp;
if (new->next) if (new->next)
new->next->prev = new; new->next->prev = new;
else else
int_last = new; int_last = new;
*nextp = new; *nextp = new;
return new; return new;
} }
struct interface *lookup_interface(char *name) struct interface *lookup_interface(char *name)
...@@ -131,7 +131,7 @@ struct interface *lookup_interface(char *name) ...@@ -131,7 +131,7 @@ struct interface *lookup_interface(char *name)
/* otherwise we read a limited list */ /* otherwise we read a limited list */
if (if_readlist_proc(name) < 0) if (if_readlist_proc(name) < 0)
return NULL; return NULL;
return if_cache_add(name); return if_cache_add(name);
} }
...@@ -170,7 +170,7 @@ static int if_readconf(void) ...@@ -170,7 +170,7 @@ static int if_readconf(void)
int skfd; int skfd;
/* SIOCGIFCONF currently seems to only work properly on AF_INET sockets /* SIOCGIFCONF currently seems to only work properly on AF_INET sockets
(as of 2.1.128) */ (as of 2.1.128) */
skfd = get_socket_for_af(AF_INET); skfd = get_socket_for_af(AF_INET);
if (skfd < 0) { if (skfd < 0) {
fprintf(stderr, _("warning: no inet socket available: %s\n"), fprintf(stderr, _("warning: no inet socket available: %s\n"),
...@@ -323,9 +323,9 @@ static int if_readlist_proc(char *target) ...@@ -323,9 +323,9 @@ static int if_readlist_proc(char *target)
fh = fopen(_PATH_PROCNET_DEV, "r"); fh = fopen(_PATH_PROCNET_DEV, "r");
if (!fh) { if (!fh) {
fprintf(stderr, _("Warning: cannot open %s (%s). Limited output.\n"), fprintf(stderr, _("Warning: cannot open %s (%s). Limited output.\n"),
_PATH_PROCNET_DEV, strerror(errno)); _PATH_PROCNET_DEV, strerror(errno));
return -2; return -2;
} }
if (fgets(buf, sizeof buf, fh)) if (fgets(buf, sizeof buf, fh))
/* eat line */; /* eat line */;
if (fgets(buf, sizeof buf, fh)) if (fgets(buf, sizeof buf, fh))
...@@ -360,7 +360,7 @@ static int if_readlist_proc(char *target) ...@@ -360,7 +360,7 @@ static int if_readlist_proc(char *target)
err = 0; err = 0;
while (fgets(buf, sizeof buf, fh)) { while (fgets(buf, sizeof buf, fh)) {
char *s, name[IFNAMSIZ]; char *s, name[IFNAMSIZ];
s = get_name(name, buf); s = get_name(name, buf);
ife = if_cache_add(name); ife = if_cache_add(name);
get_dev_fields(s, ife); get_dev_fields(s, ife);
ife->statistics_valid = 1; ife->statistics_valid = 1;
...@@ -379,10 +379,10 @@ static int if_readlist_proc(char *target) ...@@ -379,10 +379,10 @@ static int if_readlist_proc(char *target)
return err; return err;
} }
int if_readlist(void) int if_readlist(void)
{ {
/* caller will/should check not to call this too often /* caller will/should check not to call this too often
* (i.e. only if if_list_all == 0 * (i.e. only if if_list_all == 0
*/ */
int proc_err, conf_err; int proc_err, conf_err;
...@@ -395,7 +395,7 @@ int if_readlist(void) ...@@ -395,7 +395,7 @@ int if_readlist(void)
return -1; return -1;
else else
return 0; return 0;
} }
/* Support for fetching an IPX address */ /* Support for fetching an IPX address */
...@@ -412,7 +412,7 @@ int if_fetch(struct interface *ife) ...@@ -412,7 +412,7 @@ int if_fetch(struct interface *ife)
{ {
struct ifreq ifr; struct ifreq ifr;
int fd; int fd;
char *ifname = ife->name; char *ifname = ife->name;
strcpy(ifr.ifr_name, ifname); strcpy(ifr.ifr_name, ifname);
if (ioctl(skfd, SIOCGIFFLAGS, &ifr) < 0) if (ioctl(skfd, SIOCGIFFLAGS, &ifr) < 0)
...@@ -562,29 +562,29 @@ int if_fetch(struct interface *ife) ...@@ -562,29 +562,29 @@ int if_fetch(struct interface *ife)
} }
int do_if_fetch(struct interface *ife) int do_if_fetch(struct interface *ife)
{ {
if (if_fetch(ife) < 0) { if (if_fetch(ife) < 0) {
char *errmsg; char *errmsg;
if (errno == ENODEV) { if (errno == ENODEV) {
/* Give better error message for this case. */ /* Give better error message for this case. */
errmsg = _("Device not found"); errmsg = _("Device not found");
} else { } else {
errmsg = strerror(errno); errmsg = strerror(errno);
} }
fprintf(stderr, _("%s: error fetching interface information: %s\n"), fprintf(stderr, _("%s: error fetching interface information: %s\n"),
ife->name, errmsg); ife->name, errmsg);
return -1; return -1;
} }
return 0; return 0;
} }
int do_if_print(struct interface *ife, void *cookie) int do_if_print(struct interface *ife, void *cookie)
{ {
int *opt_a = (int *) cookie; int *opt_a = (int *) cookie;
int res; int res;
res = do_if_fetch(ife); res = do_if_fetch(ife);
if (res >= 0) { if (res >= 0) {
if ((ife->flags & IFF_UP) || *opt_a) if ((ife->flags & IFF_UP) || *opt_a)
ife_print(ife); ife_print(ife);
} }
...@@ -653,7 +653,7 @@ void ife_print_long(struct interface *ptr) ...@@ -653,7 +653,7 @@ void ife_print_long(struct interface *ptr)
const char *Rext = "B"; const char *Rext = "B";
const char *Text = "B"; const char *Text = "B";
static char flags[200]; static char flags[200];
#if HAVE_AFIPX #if HAVE_AFIPX
static struct aftype *ipxtype = NULL; static struct aftype *ipxtype = NULL;
#endif #endif
...@@ -726,7 +726,7 @@ void ife_print_long(struct interface *ptr) ...@@ -726,7 +726,7 @@ void ife_print_long(struct interface *ptr)
flags[strlen(flags)-1] = '>'; flags[strlen(flags)-1] = '>';
else else
flags[strlen(flags)-1] = 0; flags[strlen(flags)-1] = 0;
printf(_("%s: %s mtu %d"), printf(_("%s: %s mtu %d"),
ptr->name, flags, ptr->mtu); ptr->name, flags, ptr->mtu);
...@@ -768,8 +768,8 @@ void ife_print_long(struct interface *ptr) ...@@ -768,8 +768,8 @@ void ife_print_long(struct interface *ptr)
addr6p[4], addr6p[5], addr6p[6], addr6p[7]); addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
inet6_aftype.input(1, addr6, (struct sockaddr *) &sap); inet6_aftype.input(1, addr6, (struct sockaddr *) &sap);
printf(_(" %s %s prefixlen %d"), printf(_(" %s %s prefixlen %d"),
inet6_aftype.name, inet6_aftype.name,
inet6_aftype.sprint((struct sockaddr *) &sap, 1), inet6_aftype.sprint((struct sockaddr *) &sap, 1),
plen); plen);
printf(_(" scopeid 0x%x"), scope); printf(_(" scopeid 0x%x"), scope);
...@@ -835,7 +835,7 @@ void ife_print_long(struct interface *ptr) ...@@ -835,7 +835,7 @@ void ife_print_long(struct interface *ptr)
} }
#endif #endif
/* For some hardware types (eg Ash, ATM) we don't print the /* For some hardware types (eg Ash, ATM) we don't print the
hardware address if it's null. */ hardware address if it's null. */
if (hw->print != NULL && (! (hw_null_address(hw, ptr->hwaddr) && if (hw->print != NULL && (! (hw_null_address(hw, ptr->hwaddr) &&
hw->suppress_null_addr))) hw->suppress_null_addr)))
...@@ -863,8 +863,8 @@ void ife_print_long(struct interface *ptr) ...@@ -863,8 +863,8 @@ void ife_print_long(struct interface *ptr)
* not for the aliases, although strictly speaking they're shared * not for the aliases, although strictly speaking they're shared
* by all addresses. * by all addresses.
*/ */
rx = ptr->stats.rx_bytes; rx = ptr->stats.rx_bytes;
short_rx = rx * 10; short_rx = rx * 10;
if (rx > 1125899906842624ull) { if (rx > 1125899906842624ull) {
short_rx /= 1125899906842624ull; short_rx /= 1125899906842624ull;
Rext = "PiB"; Rext = "PiB";
...@@ -901,9 +901,9 @@ void ife_print_long(struct interface *ptr) ...@@ -901,9 +901,9 @@ void ife_print_long(struct interface *ptr)
} }
printf(" "); printf(" ");
printf(_("RX packets %llu bytes %llu (%lu.%lu %s)\n"), printf(_("RX packets %llu bytes %llu (%lu.%lu %s)\n"),
ptr->stats.rx_packets, ptr->stats.rx_packets,
rx, (unsigned long)(short_rx / 10), rx, (unsigned long)(short_rx / 10),
(unsigned long)(short_rx % 10), Rext); (unsigned long)(short_rx % 10), Rext);
if (can_compress) { if (can_compress) {
printf(" "); printf(" ");
...@@ -911,14 +911,14 @@ void ife_print_long(struct interface *ptr) ...@@ -911,14 +911,14 @@ void ife_print_long(struct interface *ptr)
} }
printf(" "); printf(" ");
printf(_("RX errors %lu dropped %lu overruns %lu frame %lu\n"), printf(_("RX errors %lu dropped %lu overruns %lu frame %lu\n"),
ptr->stats.rx_errors, ptr->stats.rx_dropped, ptr->stats.rx_errors, ptr->stats.rx_dropped,
ptr->stats.rx_fifo_errors, ptr->stats.rx_frame_errors); ptr->stats.rx_fifo_errors, ptr->stats.rx_frame_errors);
printf(" "); printf(" ");
printf(_("TX packets %llu bytes %llu (%lu.%lu %s)\n"), printf(_("TX packets %llu bytes %llu (%lu.%lu %s)\n"),
ptr->stats.tx_packets, ptr->stats.tx_packets,
tx, (unsigned long)(short_tx / 10), tx, (unsigned long)(short_tx / 10),
(unsigned long)(short_tx % 10), Text); (unsigned long)(short_tx % 10), Text);
if (can_compress) { if (can_compress) {
printf(" "); printf(" ");
...@@ -936,7 +936,7 @@ void ife_print_long(struct interface *ptr) ...@@ -936,7 +936,7 @@ void ife_print_long(struct interface *ptr)
printf(" device "); printf(" device ");
if (ptr->map.irq) if (ptr->map.irq)
printf(_("interrupt %d "), ptr->map.irq); printf(_("interrupt %d "), ptr->map.irq);
if (ptr->map.base_addr >= 0x100) /* Only print devices using it for if (ptr->map.base_addr >= 0x100) /* Only print devices using it for
I/O maps */ I/O maps */
printf(_("base 0x%x "), ptr->map.base_addr); printf(_("base 0x%x "), ptr->map.base_addr);
if (ptr->map.mem_start) { if (ptr->map.mem_start) {
......
...@@ -133,7 +133,7 @@ static int IPX_input(int type, char *bufp, struct sockaddr *sap) ...@@ -133,7 +133,7 @@ static int IPX_input(int type, char *bufp, struct sockaddr *sap)
if (!sai) if (!sai)
return (-1); return (-1);
sai->sipx_family = AF_IPX; sai->sipx_family = AF_IPX;
sai->sipx_network = htonl(0); sai->sipx_network = htonl(0);
sai->sipx_node[0] = sai->sipx_node[1] = sai->sipx_node[2] = sai->sipx_node[0] = sai->sipx_node[1] = sai->sipx_node[2] =
......
...@@ -47,7 +47,7 @@ int IPX_rprint(int options) ...@@ -47,7 +47,7 @@ int IPX_rprint(int options)
if (!fp) { if (!fp) {
fp = fopen(_PATH_PROCNET_IPX_ROUTE2, "r"); fp = fopen(_PATH_PROCNET_IPX_ROUTE2, "r");
} }
if (!fp) { if (!fp) {
perror(NULL); perror(NULL);
printf(_("IPX routing not in file %s or %s found.\n"), _PATH_PROCNET_IPX_ROUTE1, _PATH_PROCNET_IPX_ROUTE2); printf(_("IPX routing not in file %s or %s found.\n"), _PATH_PROCNET_IPX_ROUTE1, _PATH_PROCNET_IPX_ROUTE2);
......
/********************************************************************* /*********************************************************************
* *
* Filename: irda.c * Filename: irda.c
* Version: 0.2 * Version: 0.2
* Description: A second attempt to make ifconfig understand IrDA * Description: A second attempt to make ifconfig understand IrDA
...@@ -10,22 +10,22 @@ ...@@ -10,22 +10,22 @@
* Modified by: Dag Brattli <dagb@cs.uit.no> * Modified by: Dag Brattli <dagb@cs.uit.no>
* Modified at: Wed May 1 11:51:44 CEST 2002 * Modified at: Wed May 1 11:51:44 CEST 2002
* Modified by: Christoph Bartelmus <christoph@bartelmus.de> * Modified by: Christoph Bartelmus <christoph@bartelmus.de>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version. * the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA * MA 02111-1307 USA
* *
********************************************************************/ ********************************************************************/
#include "config.h" #include "config.h"
...@@ -63,7 +63,7 @@ static const char *irda_print(const char *ptr) ...@@ -63,7 +63,7 @@ static const char *irda_print(const char *ptr)
{ {
static char buff[12]; static char buff[12];
snprintf(buff, 12, "%02x:%02x:%02x:%02x", ptr[3], ptr[2], snprintf(buff, 12, "%02x:%02x:%02x:%02x", ptr[3], ptr[2],
ptr[1], ptr[0]); ptr[1], ptr[0]);
return (buff); return (buff);
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* your option) any later version. * your option) any later version.
*/ */
/* /*
* This needs to be included AFTER the KErnel Header Files * This needs to be included AFTER the KErnel Header Files
* one of the FEATURE_ should be defined to get the Feature Variable * one of the FEATURE_ should be defined to get the Feature Variable
* definition included * definition included
......
...@@ -46,7 +46,7 @@ struct aftype { ...@@ -46,7 +46,7 @@ struct aftype {
int (*rinput) (int typ, int ext, char **argv); int (*rinput) (int typ, int ext, char **argv);
/* may modify src */ /* may modify src */
int (*getmask) (char *src, struct sockaddr * mask, char *name); int (*getmask) (char *src, struct sockaddr *mask, char *name);
int fd; int fd;
char *flag_file; char *flag_file;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* Copyright 1993 MicroWalt Corporation * Copyright 1993 MicroWalt Corporation
* *
* Changes: * Changes:
* 980701 {1.21} Arnaldo Carvalho de Melo - GNU gettext instead of catgets, * 980701 {1.21} Arnaldo Carvalho de Melo - GNU gettext instead of catgets,
* strncpy instead of strcpy for * strncpy instead of strcpy for
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* Changes: * Changes:
* 980701 {0.02} Arnaldo Carvalho de Melo GNU gettext instead of catgets * 980701 {0.02} Arnaldo Carvalho de Melo GNU gettext instead of catgets
* *
* *
* This program is free software; you can redistribute it * This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General * and/or modify it under the terms of the GNU General
......
/* Copyright 1998 by Andi Kleen. Subject to the GPL. */ /* Copyright 1998 by Andi Kleen. Subject to the GPL. */
/* rewritten by bernd eckenfels because of complicated alias semantic */ /* rewritten by bernd eckenfels because of complicated alias semantic */
/* $Id: nstrcmp.c,v 1.4 2004/06/03 22:49:17 ecki Exp $ */ /* $Id: nstrcmp.c,v 1.4 2004/06/03 22:49:17 ecki Exp $ */
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
...@@ -12,7 +12,7 @@ char* cutalias(char* name) ...@@ -12,7 +12,7 @@ char* cutalias(char* name)
{ {
int digit = 0; int digit = 0;
int pos; int pos;
for(pos=strlen(name); pos>0; pos--) for(pos=strlen(name); pos>0; pos--)
{ {
if (name[pos-1]==':' && digit) if (name[pos-1]==':' && digit)
...@@ -58,41 +58,41 @@ int nstrcmp(const char *ap, const char *bp) ...@@ -58,41 +58,41 @@ int nstrcmp(const char *ap, const char *bp)
if (res != 0) if (res != 0)
{ free(a); free(b); return res; } { free(a); free(b); return res; }
if (aindex > bindex) if (aindex > bindex)
{ free(a); free(b); return 1; } { free(a); free(b); return 1; }
if (aindex < bindex) if (aindex < bindex)
{ free(a); free(b); return -1; } { free(a); free(b); return -1; }
an = a+aindex; an = a+aindex;
bn = b+bindex; bn = b+bindex;
av = atoi(an); av = atoi(an);
bv = atoi(bn); bv = atoi(bn);
if (av < bv) if (av < bv)
{ free(a); free(b); return -1; } { free(a); free(b); return -1; }
if (av > bv) if (av > bv)
{ free(a); free(b); return 1; } { free(a); free(b); return 1; }
av = -1; av = -1;
if (aalias != NULL) if (aalias != NULL)
av = atoi(aalias); av = atoi(aalias);
bv = -1; bv = -1;
if (balias != NULL) if (balias != NULL)
bv = atoi(balias); bv = atoi(balias);
free(a); free(b); free(a); free(b);
if (av < bv) if (av < bv)
return -1; return -1;
if (av > bv) if (av > bv)
return 1; return 1;
return 0; return 0;
} }
...@@ -118,7 +118,7 @@ int dotest(char* a, char* b, int exp) ...@@ -118,7 +118,7 @@ int dotest(char* a, char* b, int exp)
int main() int main()
{ {
int err = 0; int err = 0;
err |= dotest("eth1", "eth1", 0); err |= dotest("eth1", "eth1", 0);
err |= dotest("eth0:1", "eth0:1", 0); err |= dotest("eth0:1", "eth0:1", 0);
err |= dotest("lan", "lan", 0); err |= dotest("lan", "lan", 0);
...@@ -129,7 +129,7 @@ int main() ...@@ -129,7 +129,7 @@ int main()
err |= dotest("a:", "a:", 0); err |= dotest("a:", "a:", 0);
err |= dotest(":a", ":a", 0); err |= dotest(":a", ":a", 0);
err |= dotest("a", "aa", -1); err |= dotest("a", "aa", -1);
err |= dotest("eth0", "eth1", -1); err |= dotest("eth0", "eth1", -1);
err |= dotest("eth1", "eth20", -1); err |= dotest("eth1", "eth20", -1);
err |= dotest("eth20", "eth100", -1); err |= dotest("eth20", "eth100", -1);
...@@ -139,10 +139,10 @@ int main() ...@@ -139,10 +139,10 @@ int main()
err |= dotest("eth1:10", "eth13:10", -1); err |= dotest("eth1:10", "eth13:10", -1);
err |= dotest("eth1:1", "eth1:13", -1); err |= dotest("eth1:1", "eth1:13", -1);
err |= dotest("a", "a:", -1); err |= dotest("a", "a:", -1);
err |= dotest("aa", "a", 1); err |= dotest("aa", "a", 1);
err |= dotest("eth2", "eth1", 1); err |= dotest("eth2", "eth1", 1);
err |= dotest("eth13", "eth1", 1); err |= dotest("eth13", "eth1", 1);
err |= dotest("eth2", "eth", 1); err |= dotest("eth2", "eth", 1);
err |= dotest("eth2:10", "eth2:1", 1); err |= dotest("eth2:10", "eth2:1", 1);
err |= dotest("eth2:5", "eth2:4", 1); err |= dotest("eth2:5", "eth2:4", 1);
......
/* /*
* lib/pathnames.h This file contains the definitions of the path * lib/pathnames.h This file contains the definitions of the path
* names used by the NET-LIB. * names used by the NET-LIB.
* *
* NET-LIB * NET-LIB
* *
* Version: lib/pathnames.h 1.37 (1997-08-23) * Version: lib/pathnames.h 1.37 (1997-08-23)
* *
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Copyright 1993 MicroWalt Corporation * Copyright 1993 MicroWalt Corporation
* *
* Modified by Alan Cox, May 94 to cover NET-3 * Modified by Alan Cox, May 94 to cover NET-3
* *
* Changes: * Changes:
* 980701 {1.12} Arnaldo Carvalho de Melo - GNU gettext instead of catgets * 980701 {1.12} Arnaldo Carvalho de Melo - GNU gettext instead of catgets
* *
......
/* Tolerant /proc file parser. Copyright 1998 Andi Kleen */ /* Tolerant /proc file parser. Copyright 1998 Andi Kleen */
/* $Id: proc.c,v 1.5 2007/12/01 18:44:57 ecki Exp $ */ /* $Id: proc.c,v 1.5 2007/12/01 18:44:57 ecki Exp $ */
/* Fixme: cannot currently cope with removed fields */ /* Fixme: cannot currently cope with removed fields */
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
...@@ -51,7 +51,7 @@ char *proc_gen_fmt(char *name, int more, FILE * fh,...) ...@@ -51,7 +51,7 @@ char *proc_gen_fmt(char *name, int more, FILE * fh,...)
return strdup(format); return strdup(format);
} }
/* /*
* this will generate a bitmask of present/missing fields in the header of * this will generate a bitmask of present/missing fields in the header of
* a /proc file. * a /proc file.
*/ */
...@@ -84,12 +84,12 @@ FILE *proc_fopen(const char *name) ...@@ -84,12 +84,12 @@ FILE *proc_fopen(const char *name)
if (fd == NULL) if (fd == NULL)
return NULL; return NULL;
if (!buffer) { if (!buffer) {
pagesz = getpagesize(); pagesz = getpagesize();
buffer = malloc(pagesz); buffer = malloc(pagesz);
} }
setvbuf(fd, buffer, _IOFBF, pagesz); setvbuf(fd, buffer, _IOFBF, pagesz);
return fd; return fd;
} }
/* /*
* prototypes for proc.c * prototypes for proc.c
*/ */
char *proc_gen_fmt(char *name, int more, FILE * fh,...); char *proc_gen_fmt(char *name, int more, FILE * fh,...);
......
...@@ -63,11 +63,11 @@ static int in_tr(char *bufp, struct sockaddr *sap) ...@@ -63,11 +63,11 @@ static int in_tr(char *bufp, struct sockaddr *sap)
int i, val; int i, val;
#ifdef ARPHRD_IEEE802_TR #ifdef ARPHRD_IEEE802_TR
if (kernel_version() < KRELEASE(2,3,30)) { if (kernel_version() < KRELEASE(2,3,30)) {
sap->sa_family = tr_hwtype.type; sap->sa_family = tr_hwtype.type;
} else { } else {
sap->sa_family = tr_hwtype1.type; sap->sa_family = tr_hwtype1.type;
} }
#else #else
sap->sa_family = tr_hwtype.type; sap->sa_family = tr_hwtype.type;
#warning "Limited functionality, no support for ARPHRD_IEEE802_TR (old kernel headers?)" #warning "Limited functionality, no support for ARPHRD_IEEE802_TR (old kernel headers?)"
......
/* Copyright 1998 by Andi Kleen. Subject to the GPL. */ /* Copyright 1998 by Andi Kleen. Subject to the GPL. */
/* $Id: util.c,v 1.4 1998/11/17 15:17:02 freitag Exp $ */ /* $Id: util.c,v 1.4 1998/11/17 15:17:02 freitag Exp $ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -43,9 +43,9 @@ int kernel_version(void) ...@@ -43,9 +43,9 @@ int kernel_version(void)
} }
/* Like strncpy but make sure the resulting string is always 0 terminated. */ /* Like strncpy but make sure the resulting string is always 0 terminated. */
char *safe_strncpy(char *dst, const char *src, size_t size) char *safe_strncpy(char *dst, const char *src, size_t size)
{ {
dst[size-1] = '\0'; dst[size-1] = '\0';
return strncpy(dst,src,size-1); return strncpy(dst,src,size-1);
} }
...@@ -12,7 +12,7 @@ int kernel_version(void); ...@@ -12,7 +12,7 @@ int kernel_version(void);
int nstrcmp(const char *, const char *); int nstrcmp(const char *, const char *);
char *safe_strncpy(char *dst, const char *src, size_t size); char *safe_strncpy(char *dst, const char *src, size_t size);
#define netmin(a,b) ((a)<(b) ? (a) : (b)) #define netmin(a,b) ((a)<(b) ? (a) : (b))
......
...@@ -156,7 +156,7 @@ struct hwtype x25_hwtype = { ...@@ -156,7 +156,7 @@ struct hwtype x25_hwtype = {
}; };
struct aftype x25_aftype = struct aftype x25_aftype =
{ {
"x25", NULL, /*"CCITT X.25", */ AF_X25, X25_ADDR_LEN, "x25", NULL, /*"CCITT X.25", */ AF_X25, X25_ADDR_LEN,
X25_print, X25_sprint, X25_input, X25_herror, X25_print, X25_sprint, X25_input, X25_herror,
X25_rprint, X25_rinput, NULL /* getmask */, X25_rprint, X25_rinput, NULL /* getmask */,
......
...@@ -112,7 +112,7 @@ static int X25_setroute(int action, int options, char **args) ...@@ -112,7 +112,7 @@ static int X25_setroute(int action, int options, char **args)
perror("socket"); perror("socket");
return(E_SOCK); return(E_SOCK);
} }
/* Tell the kernel to accept this route. */ /* Tell the kernel to accept this route. */
if (action==RTACTION_DEL) { if (action==RTACTION_DEL) {
if (ioctl(skfd, SIOCDELRT, &rt) < 0) { if (ioctl(skfd, SIOCDELRT, &rt) < 0) {
...@@ -138,14 +138,14 @@ int X25_rinput(int action, int options, char **args) ...@@ -138,14 +138,14 @@ int X25_rinput(int action, int options, char **args)
if (action == RTACTION_FLUSH) { if (action == RTACTION_FLUSH) {
fprintf(stderr,"Flushing `x25' routing table not supported\n"); fprintf(stderr,"Flushing `x25' routing table not supported\n");
return(usage()); return(usage());
} }
if (options & FLAG_CACHE) { if (options & FLAG_CACHE) {
fprintf(stderr,"Modifying `x25' routing cache not supported\n"); fprintf(stderr,"Modifying `x25' routing cache not supported\n");
return(usage()); return(usage());
} }
if ((*args == NULL) || (action == RTACTION_HELP)) if ((*args == NULL) || (action == RTACTION_HELP))
return(usage()); return(usage());
return(X25_setroute(action, options, args)); return(X25_setroute(action, options, args));
} }
#endif /* HAVE_AFX25 */ #endif /* HAVE_AFX25 */
...@@ -169,7 +169,7 @@ const struct { ...@@ -169,7 +169,7 @@ const struct {
{ "1000baseT", {0, ADVERTISE_1000HALF|ADVERTISE_1000FULL} }, { "1000baseT", {0, ADVERTISE_1000HALF|ADVERTISE_1000FULL} },
}; };
#define NMEDIA (sizeof(media)/sizeof(media[0])) #define NMEDIA (sizeof(media)/sizeof(media[0]))
/* Parse an argument list of media types */ /* Parse an argument list of media types */
static int parse_media(char *arg, unsigned *bmcr2) static int parse_media(char *arg, unsigned *bmcr2)
{ {
...@@ -479,7 +479,7 @@ int main(int argc, char **argv) ...@@ -479,7 +479,7 @@ int main(int argc, char **argv)
{ {
int i, c, ret, errflag = 0; int i, c, ret, errflag = 0;
unsigned ctrl1000 = 0; unsigned ctrl1000 = 0;
while ((c = getopt_long(argc, argv, "A:F:p:lrRvVw?", longopts, 0)) != EOF) while ((c = getopt_long(argc, argv, "A:F:p:lrRvVw?", longopts, 0)) != EOF)
switch (c) { switch (c) {
case 'A': nway_advertise = parse_media(optarg, &ctrl1000); break; case 'A': nway_advertise = parse_media(optarg, &ctrl1000); break;
...@@ -515,7 +515,7 @@ int main(int argc, char **argv) ...@@ -515,7 +515,7 @@ int main(int argc, char **argv)
} }
if (verbose > 1) if (verbose > 1)
printf("Using SIOCGMIIPHY=0x%x\n", SIOCGMIIPHY); printf("Using SIOCGMIIPHY=0x%x\n", SIOCGMIIPHY);
/* No remaining args means show all interfaces. */ /* No remaining args means show all interfaces. */
if (optind == argc) { if (optind == argc) {
......
/* /*
* Name Interfaces based on MAC address. * Name Interfaces based on MAC address.
* Writen 2000 by Andi Kleen. * Writen 2000 by Andi Kleen.
* Subject to the Gnu Public License, version 2. * Subject to the Gnu Public License, version 2.
* TODO: make it support token ring etc. * TODO: make it support token ring etc.
* $Id: nameif.c,v 1.4 2003/09/11 03:46:49 ak Exp $ * $Id: nameif.c,v 1.4 2003/09/11 03:46:49 ak Exp $
*/ */
#ifndef _GNU_SOURCE #ifndef _GNU_SOURCE
#define _GNU_SOURCE #define _GNU_SOURCE
#endif #endif
#include <stdio.h> #include <stdio.h>
...@@ -21,68 +21,68 @@ ...@@ -21,68 +21,68 @@
#include <net/if.h> #include <net/if.h>
#include <linux/sockios.h> #include <linux/sockios.h>
#include <errno.h> #include <errno.h>
#include "intl.h" #include "intl.h"
#include "net-support.h" #include "net-support.h"
#include "util.h" #include "util.h"
const char default_conf[] = "/etc/mactab"; const char default_conf[] = "/etc/mactab";
const char *fname = default_conf; const char *fname = default_conf;
int use_syslog; int use_syslog;
int ctl_sk = -1; int ctl_sk = -1;
void err(char *msg) void err(char *msg)
{ {
if (use_syslog) { if (use_syslog) {
syslog(LOG_ERR,"%s: %m", msg); syslog(LOG_ERR,"%s: %m", msg);
} else { } else {
perror(msg); perror(msg);
} }
exit(1); exit(1);
} }
void complain(char *fmt, ...) void complain(char *fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap,fmt); va_start(ap,fmt);
if (use_syslog) { if (use_syslog) {
vsyslog(LOG_ERR,fmt,ap); vsyslog(LOG_ERR,fmt,ap);
} else { } else {
vfprintf(stderr,fmt,ap); vfprintf(stderr,fmt,ap);
fputc('\n',stderr); fputc('\n',stderr);
} }
va_end(ap); va_end(ap);
exit(1); exit(1);
} }
void warning(char *fmt, ...) void warning(char *fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap,fmt); va_start(ap,fmt);
if (use_syslog) { if (use_syslog) {
vsyslog(LOG_ERR,fmt,ap); vsyslog(LOG_ERR,fmt,ap);
} else { } else {
vfprintf(stderr,fmt,ap); vfprintf(stderr,fmt,ap);
fputc('\n',stderr); fputc('\n',stderr);
} }
va_end(ap); va_end(ap);
} }
int parsemac(char *str, unsigned char *mac) int parsemac(char *str, unsigned char *mac)
{ {
char *s; char *s;
while ((s = strsep(&str, ":")) != NULL) { while ((s = strsep(&str, ":")) != NULL) {
unsigned byte; unsigned byte;
if (sscanf(s,"%x", &byte)!=1 || byte > 0xff) if (sscanf(s,"%x", &byte)!=1 || byte > 0xff)
return -1; return -1;
*mac++ = byte; *mac++ = byte;
} }
return 0; return 0;
} }
void opensock(void) void opensock(void)
{ {
if (ctl_sk < 0) if (ctl_sk < 0)
ctl_sk = socket(PF_INET,SOCK_DGRAM,0); ctl_sk = socket(PF_INET,SOCK_DGRAM,0);
} }
#ifndef ifr_newname #ifndef ifr_newname
...@@ -92,7 +92,7 @@ void opensock(void) ...@@ -92,7 +92,7 @@ void opensock(void)
int setname(char *oldname, char *newname) int setname(char *oldname, char *newname)
{ {
struct ifreq ifr; struct ifreq ifr;
opensock(); opensock();
memset(&ifr,0,sizeof(struct ifreq)); memset(&ifr,0,sizeof(struct ifreq));
safe_strncpy(ifr.ifr_name, oldname, IFNAMSIZ); safe_strncpy(ifr.ifr_name, oldname, IFNAMSIZ);
safe_strncpy(ifr.ifr_newname, newname, IFNAMSIZ); safe_strncpy(ifr.ifr_newname, newname, IFNAMSIZ);
...@@ -103,107 +103,107 @@ int getmac(char *name, unsigned char *mac) ...@@ -103,107 +103,107 @@ int getmac(char *name, unsigned char *mac)
{ {
int r; int r;
struct ifreq ifr; struct ifreq ifr;
opensock(); opensock();
memset(&ifr,0,sizeof(struct ifreq)); memset(&ifr,0,sizeof(struct ifreq));
safe_strncpy(ifr.ifr_name, name, IFNAMSIZ); safe_strncpy(ifr.ifr_name, name, IFNAMSIZ);
r = ioctl(ctl_sk, SIOCGIFHWADDR, &ifr); r = ioctl(ctl_sk, SIOCGIFHWADDR, &ifr);
memcpy(mac, ifr.ifr_hwaddr.sa_data, 6); memcpy(mac, ifr.ifr_hwaddr.sa_data, 6);
return r; return r;
} }
struct change { struct change {
struct change *next; struct change *next;
int found; int found;
char ifname[IFNAMSIZ+1]; char ifname[IFNAMSIZ+1];
unsigned char mac[6]; unsigned char mac[6];
}; };
struct change *clist; struct change *clist;
struct change *lookupmac(unsigned char *mac) struct change *lookupmac(unsigned char *mac)
{ {
struct change *ch; struct change *ch;
for (ch = clist;ch;ch = ch->next) for (ch = clist;ch;ch = ch->next)
if (!memcmp(ch->mac, mac, 6)) if (!memcmp(ch->mac, mac, 6))
return ch; return ch;
return NULL; return NULL;
} }
int addchange(char *p, struct change *ch, char *pos) int addchange(char *p, struct change *ch, char *pos)
{ {
if (strchr(ch->ifname, ':')) if (strchr(ch->ifname, ':'))
warning(_("alias device %s at %s probably has no mac"), warning(_("alias device %s at %s probably has no mac"),
ch->ifname, pos); ch->ifname, pos);
if (parsemac(p,ch->mac) < 0) if (parsemac(p,ch->mac) < 0)
complain(_("cannot parse MAC `%s' at %s"), p, pos); complain(_("cannot parse MAC `%s' at %s"), p, pos);
ch->next = clist; ch->next = clist;
clist = ch; clist = ch;
return 0; return 0;
} }
void readconf(void) void readconf(void)
{ {
char *line; char *line;
size_t linel; size_t linel;
int linenum; int linenum;
FILE *ifh; FILE *ifh;
char *p; char *p;
int n; int n;
struct change *ch = NULL; struct change *ch = NULL;
ifh = fopen(fname, "r"); ifh = fopen(fname, "r");
if (!ifh) if (!ifh)
complain(_("opening configuration file %s: %s"),fname,strerror(errno)); complain(_("opening configuration file %s: %s"),fname,strerror(errno));
line = NULL; line = NULL;
linel = 0; linel = 0;
linenum = 1; linenum = 1;
while (getdelim(&line, &linel, '\n', ifh) > 0) { while (getdelim(&line, &linel, '\n', ifh) > 0) {
char pos[20]; char pos[20];
sprintf(pos, _("line %d"), linenum); sprintf(pos, _("line %d"), linenum);
if ((p = strchr(line,'#')) != NULL) if ((p = strchr(line,'#')) != NULL)
*p = '\0'; *p = '\0';
p = line; p = line;
while (isspace(*p)) while (isspace(*p))
++p; ++p;
if (*p == '\0') if (*p == '\0')
continue; continue;
n = strcspn(p, " \t"); n = strcspn(p, " \t");
if (n > IFNAMSIZ-1) if (n > IFNAMSIZ-1)
complain(_("interface name too long at line %d"), line); complain(_("interface name too long at line %d"), line);
ch = xmalloc(sizeof(struct change)); ch = xmalloc(sizeof(struct change));
memcpy(ch->ifname, p, n); memcpy(ch->ifname, p, n);
ch->ifname[n] = 0; ch->ifname[n] = 0;
p += n; p += n;
p += strspn(p, " \t"); p += strspn(p, " \t");
n = strspn(p, "0123456789ABCDEFabcdef:"); n = strspn(p, "0123456789ABCDEFabcdef:");
p[n] = 0; p[n] = 0;
addchange(p, ch, pos); addchange(p, ch, pos);
linenum++; linenum++;
} }
fclose(ifh); fclose(ifh);
} }
struct option lopt[] = { struct option lopt[] = {
{"syslog", 0, NULL, 's' }, {"syslog", 0, NULL, 's' },
{"config-file", 1, NULL, 'c' }, {"config-file", 1, NULL, 'c' },
{"help", 0, NULL, '?' }, {"help", 0, NULL, '?' },
{NULL}, {NULL},
}; };
void usage(void) void usage(void)
{ {
fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}\n")); fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}\n"));
exit(E_USAGE); exit(E_USAGE);
} }
int main(int ac, char **av) int main(int ac, char **av)
{ {
FILE *ifh; FILE *ifh;
char *p; char *p;
int n; int n;
int linenum; int linenum;
char *line = NULL; char *line = NULL;
size_t linel = 0; size_t linel = 0;
int ret = 0; int ret = 0;
...@@ -211,10 +211,10 @@ int main(int ac, char **av) ...@@ -211,10 +211,10 @@ int main(int ac, char **av)
for (;;) { for (;;) {
int c = getopt_long(ac,av,"c:s",lopt,NULL); int c = getopt_long(ac,av,"c:s",lopt,NULL);
if (c == -1) break; if (c == -1) break;
switch (c) { switch (c) {
default: default:
case '?': case '?':
usage(); usage();
case 'c': case 'c':
fname = optarg; fname = optarg;
break; break;
...@@ -224,76 +224,76 @@ int main(int ac, char **av) ...@@ -224,76 +224,76 @@ int main(int ac, char **av)
} }
} }
if (use_syslog) if (use_syslog)
openlog("nameif",0,LOG_LOCAL0); openlog("nameif",0,LOG_LOCAL0);
while (optind < ac) { while (optind < ac) {
struct change *ch = xmalloc(sizeof(struct change)); struct change *ch = xmalloc(sizeof(struct change));
char pos[30]; char pos[30];
if ((ac-optind) & 1) if ((ac-optind) & 1)
usage(); usage();
if (strlen(av[optind])+1>IFNAMSIZ) if (strlen(av[optind])+1>IFNAMSIZ)
complain(_("interface name `%s' too long"), av[optind]); complain(_("interface name `%s' too long"), av[optind]);
strcpy(ch->ifname, av[optind]); strcpy(ch->ifname, av[optind]);
optind++; optind++;
sprintf(pos,_("argument %d"),optind); sprintf(pos,_("argument %d"),optind);
addchange(av[optind], ch, pos); addchange(av[optind], ch, pos);
optind++; optind++;
} }
if (!clist || fname != default_conf) if (!clist || fname != default_conf)
readconf(); readconf();
ifh = fopen("/proc/net/dev", "r"); ifh = fopen("/proc/net/dev", "r");
if (!ifh) complain(_("open of /proc/net/dev: %s"), strerror(errno)); if (!ifh) complain(_("open of /proc/net/dev: %s"), strerror(errno));
linenum = 0; linenum = 0;
while (getdelim(&line, &linel, '\n', ifh) > 0) { while (getdelim(&line, &linel, '\n', ifh) > 0) {
struct change *ch; struct change *ch;
unsigned char mac[6]; unsigned char mac[6];
if (linenum++ < 2) if (linenum++ < 2)
continue; continue;
p = line; p = line;
while (isspace(*p)) while (isspace(*p))
++p; ++p;
n = strcspn(p, ": \t"); n = strcspn(p, ": \t");
p[n] = 0; p[n] = 0;
if (n > IFNAMSIZ-1) if (n > IFNAMSIZ-1)
complain(_("interface name `%s' too long"), p); complain(_("interface name `%s' too long"), p);
if (getmac(p, mac) < 0) if (getmac(p, mac) < 0)
continue; continue;
ch = lookupmac(mac); ch = lookupmac(mac);
if (!ch) if (!ch)
continue; continue;
ch->found = 1; ch->found = 1;
if (strcmp(p, ch->ifname)) { if (strcmp(p, ch->ifname)) {
if (setname(p, ch->ifname) < 0) if (setname(p, ch->ifname) < 0)
complain(_("cannot change name of %s to %s: %s"), complain(_("cannot change name of %s to %s: %s"),
p, ch->ifname, strerror(errno)); p, ch->ifname, strerror(errno));
} }
} }
fclose(ifh); fclose(ifh);
while (clist) { while (clist) {
struct change *ch = clist; struct change *ch = clist;
clist = clist->next; clist = clist->next;
if (!ch->found){ if (!ch->found){
warning(_("interface '%s' not found"), ch->ifname); warning(_("interface '%s' not found"), ch->ifname);
ret = 1; ret = 1;
} }
free(ch); free(ch);
} }
if (use_syslog) if (use_syslog)
closelog(); closelog();
return ret; return ret;
} }
...@@ -23,24 +23,24 @@ ...@@ -23,24 +23,24 @@
* Modified: * Modified:
* *
*960116 {1.01} Bernd Eckenfels: verbose, cleanups *960116 {1.01} Bernd Eckenfels: verbose, cleanups
*960204 {1.10} Bernd Eckenfels: aftrans, usage, new route_info, *960204 {1.10} Bernd Eckenfels: aftrans, usage, new route_info,
* DLFT_AF * DLFT_AF
*960204 {1.11} Bernd Eckenfels: netlink support *960204 {1.11} Bernd Eckenfels: netlink support
*960204 {1.12} Bernd Eckenfels: route_init() *960204 {1.12} Bernd Eckenfels: route_init()
*960215 {1.13} Bernd Eckenfels: netlink_print honors HAVE_ *960215 {1.13} Bernd Eckenfels: netlink_print honors HAVE_
*960217 {1.14} Bernd Eckenfels: masq_info from Jos Vos and *960217 {1.14} Bernd Eckenfels: masq_info from Jos Vos and
* ax25_info from Jonathan Naylor. * ax25_info from Jonathan Naylor.
*960218 {1.15} Bernd Eckenfels: ipx_info rewritten, -e for tcp/ipx *960218 {1.15} Bernd Eckenfels: ipx_info rewritten, -e for tcp/ipx
*960220 {1.16} Bernd Eckenfels: minor output reformats, -a for -x *960220 {1.16} Bernd Eckenfels: minor output reformats, -a for -x
*960221 {1.17} Bernd Eckenfels: route_init->getroute_init *960221 {1.17} Bernd Eckenfels: route_init->getroute_init
*960426 {1.18} Bernd Eckenfels: new RTACTION, SYM/NUM, FIB/CACHE *960426 {1.18} Bernd Eckenfels: new RTACTION, SYM/NUM, FIB/CACHE
*960517 {1.19} Bernd Eckenfels: usage() spelling fix and --unix inode, *960517 {1.19} Bernd Eckenfels: usage() spelling fix and --unix inode,
* ':' is part of sock_addr for --inet * ':' is part of sock_addr for --inet
*960822 {x.xx} Frank Strauss: INET6 support *960822 {x.xx} Frank Strauss: INET6 support
* *
*970406 {1.33} Philip Copeland Added snmp reporting support module -s *970406 {1.33} Philip Copeland Added snmp reporting support module -s
* code provided by Andi Kleen * code provided by Andi Kleen
* (relly needs to be kernel hooked but * (relly needs to be kernel hooked but
* this will do in the meantime) * this will do in the meantime)
* minor header file misplacement tidy up. * minor header file misplacement tidy up.
*980815 {1.xx} Stephane Fillod: X.25 support *980815 {1.xx} Stephane Fillod: X.25 support
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
* *
*990420 {1.38} Tuan Hoang removed a useless assignment from igmp_do_one() *990420 {1.38} Tuan Hoang removed a useless assignment from igmp_do_one()
*20010404 {1.39} Arnaldo Carvalho de Melo - use setlocale *20010404 {1.39} Arnaldo Carvalho de Melo - use setlocale
*20081201 {1.42} Brian Micek added -L|--udplite options for RFC 3828 *20081201 {1.42} Brian Micek added -L|--udplite options for RFC 3828
*20020722 {1.51} Thomas Preusser added SCTP over IPv4 support *20020722 {1.51} Thomas Preusser added SCTP over IPv4 support
* *
* This program is free software; you can redistribute it * This program is free software; you can redistribute it
...@@ -289,18 +289,18 @@ static void prg_cache_add(unsigned long inode, char *name, const char *scon) ...@@ -289,18 +289,18 @@ static void prg_cache_add(unsigned long inode, char *name, const char *scon)
return; return;
} }
} }
if (!(*pnp = malloc(sizeof(**pnp)))) if (!(*pnp = malloc(sizeof(**pnp))))
return; return;
pn = *pnp; pn = *pnp;
pn->next = NULL; pn->next = NULL;
pn->inode = inode; pn->inode = inode;
if (strlen(name) > sizeof(pn->name) - 1) if (strlen(name) > sizeof(pn->name) - 1)
name[sizeof(pn->name) - 1] = '\0'; name[sizeof(pn->name) - 1] = '\0';
strcpy(pn->name, name); strcpy(pn->name, name);
{ {
int len = (strlen(scon) - sizeof(pn->scon)) + 1; int len = (strlen(scon) - sizeof(pn->scon)) + 1;
if (len > 0) if (len > 0)
strcpy(pn->scon, &scon[len + 1]); strcpy(pn->scon, &scon[len + 1]);
else else
strcpy(pn->scon, scon); strcpy(pn->scon, scon);
...@@ -356,7 +356,7 @@ static int extract_type_1_socket_inode(const char lname[], unsigned long * inode ...@@ -356,7 +356,7 @@ static int extract_type_1_socket_inode(const char lname[], unsigned long * inode
*/ */
if (strlen(lname) < PRG_SOCKET_PFXl+3) return(-1); if (strlen(lname) < PRG_SOCKET_PFXl+3) return(-1);
if (memcmp(lname, PRG_SOCKET_PFX, PRG_SOCKET_PFXl)) return(-1); if (memcmp(lname, PRG_SOCKET_PFX, PRG_SOCKET_PFXl)) return(-1);
if (lname[strlen(lname)-1] != ']') return(-1); if (lname[strlen(lname)-1] != ']') return(-1);
...@@ -417,17 +417,17 @@ static void prg_cache_load(void) ...@@ -417,17 +417,17 @@ static void prg_cache_load(void)
if (!(dirproc=opendir(PATH_PROC))) goto fail; if (!(dirproc=opendir(PATH_PROC))) goto fail;
while (errno = 0, direproc = readdir(dirproc)) { while (errno = 0, direproc = readdir(dirproc)) {
for (cs = direproc->d_name; *cs; cs++) for (cs = direproc->d_name; *cs; cs++)
if (!isdigit(*cs)) if (!isdigit(*cs))
break; break;
if (*cs) if (*cs)
continue; continue;
procfdlen = snprintf(line,sizeof(line),PATH_PROC_X_FD,direproc->d_name); procfdlen = snprintf(line,sizeof(line),PATH_PROC_X_FD,direproc->d_name);
if (procfdlen <= 0 || procfdlen >= sizeof(line) - 5) if (procfdlen <= 0 || procfdlen >= sizeof(line) - 5)
continue; continue;
errno = 0; errno = 0;
dirfd = opendir(line); dirfd = opendir(line);
if (! dirfd) { if (! dirfd) {
if (errno == EACCES) if (errno == EACCES)
eacces = 1; eacces = 1;
continue; continue;
} }
...@@ -437,7 +437,7 @@ static void prg_cache_load(void) ...@@ -437,7 +437,7 @@ static void prg_cache_load(void)
/* Skip . and .. */ /* Skip . and .. */
if (!isdigit(direfd->d_name[0])) if (!isdigit(direfd->d_name[0]))
continue; continue;
if (procfdlen + 1 + strlen(direfd->d_name) + 1 > sizeof(line)) if (procfdlen + 1 + strlen(direfd->d_name) + 1 > sizeof(line))
continue; continue;
memcpy(line + procfdlen - PATH_FD_SUFFl, PATH_FD_SUFF "/", memcpy(line + procfdlen - PATH_FD_SUFFl, PATH_FD_SUFF "/",
PATH_FD_SUFFl + 1); PATH_FD_SUFFl + 1);
...@@ -452,23 +452,23 @@ static void prg_cache_load(void) ...@@ -452,23 +452,23 @@ static void prg_cache_load(void)
continue; continue;
if (!cmdlp) { if (!cmdlp) {
if (procfdlen - PATH_FD_SUFFl + PATH_CMDLINEl >= if (procfdlen - PATH_FD_SUFFl + PATH_CMDLINEl >=
sizeof(line) - 5) sizeof(line) - 5)
continue; continue;
strcpy(line + procfdlen-PATH_FD_SUFFl, PATH_CMDLINE); strcpy(line + procfdlen-PATH_FD_SUFFl, PATH_CMDLINE);
fd = open(line, O_RDONLY); fd = open(line, O_RDONLY);
if (fd < 0) if (fd < 0)
continue; continue;
cmdllen = read(fd, cmdlbuf, sizeof(cmdlbuf) - 1); cmdllen = read(fd, cmdlbuf, sizeof(cmdlbuf) - 1);
if (close(fd)) if (close(fd))
continue; continue;
if (cmdllen == -1) if (cmdllen == -1)
continue; continue;
if (cmdllen < sizeof(cmdlbuf) - 1) if (cmdllen < sizeof(cmdlbuf) - 1)
cmdlbuf[cmdllen]='\0'; cmdlbuf[cmdllen]='\0';
if (cmdlbuf[0] == '/' && (cmdlp = strrchr(cmdlbuf, '/'))) if (cmdlbuf[0] == '/' && (cmdlp = strrchr(cmdlbuf, '/')))
cmdlp++; cmdlp++;
else else
cmdlp = cmdlbuf; cmdlp = cmdlbuf;
} }
...@@ -483,14 +483,14 @@ static void prg_cache_load(void) ...@@ -483,14 +483,14 @@ static void prg_cache_load(void)
prg_cache_add(inode, finbuf, "-"); prg_cache_add(inode, finbuf, "-");
#endif #endif
} }
closedir(dirfd); closedir(dirfd);
dirfd = NULL; dirfd = NULL;
} }
if (dirproc) if (dirproc)
closedir(dirproc); closedir(dirproc);
if (dirfd) if (dirfd)
closedir(dirfd); closedir(dirfd);
if (!eacces) if (!eacces)
return; return;
if (prg_cache_loaded == 1) { if (prg_cache_loaded == 1) {
fail: fail:
...@@ -669,7 +669,7 @@ static void igmp_do_one(int lnr, const char *line,const char *prot) ...@@ -669,7 +669,7 @@ static void igmp_do_one(int lnr, const char *line,const char *prot)
((struct sockaddr *) &mcastaddr)->sa_family); ((struct sockaddr *) &mcastaddr)->sa_family);
return; return;
} }
safe_strncpy(mcast_addr, ap->sprint((struct sockaddr *) &mcastaddr, safe_strncpy(mcast_addr, ap->sprint((struct sockaddr *) &mcastaddr,
flag_not & FLAG_NUM_HOST), sizeof(mcast_addr)); flag_not & FLAG_NUM_HOST), sizeof(mcast_addr));
printf("%-15s %-6d %s\n", device, refcnt, mcast_addr); printf("%-15s %-6d %s\n", device, refcnt, mcast_addr);
#endif #endif
...@@ -701,13 +701,13 @@ static void igmp_do_one(int lnr, const char *line,const char *prot) ...@@ -701,13 +701,13 @@ static void igmp_do_one(int lnr, const char *line,const char *prot)
fprintf(stderr, _("warning, got bogus igmp line %d.\n"), lnr); fprintf(stderr, _("warning, got bogus igmp line %d.\n"), lnr);
return; return;
} }
if ((ap = get_afntype(((struct sockaddr *) &mcastaddr)->sa_family)) == NULL) { if ((ap = get_afntype(((struct sockaddr *) &mcastaddr)->sa_family)) == NULL) {
fprintf(stderr, _("netstat: unsupported address family %d !\n"), fprintf(stderr, _("netstat: unsupported address family %d !\n"),
((struct sockaddr *) &mcastaddr)->sa_family); ((struct sockaddr *) &mcastaddr)->sa_family);
return; return;
} }
safe_strncpy(mcast_addr, ap->sprint((struct sockaddr *) &mcastaddr, safe_strncpy(mcast_addr, ap->sprint((struct sockaddr *) &mcastaddr,
flag_not & FLAG_NUM_HOST), sizeof(mcast_addr)); flag_not & FLAG_NUM_HOST), sizeof(mcast_addr));
printf("%-15s %-6d %s\n", device, refcnt, mcast_addr ); printf("%-15s %-6d %s\n", device, refcnt, mcast_addr );
#endif #endif
...@@ -762,7 +762,7 @@ static int x25_info(void) ...@@ -762,7 +762,7 @@ static int x25_info(void)
vr,vs,sendq,recvq); vr,vs,sendq,recvq);
} }
fclose(f); fclose(f);
return 0; return 0;
} }
#endif #endif
...@@ -815,7 +815,7 @@ static void print_ip_service(struct sockaddr_in *addr, char const *protname, ...@@ -815,7 +815,7 @@ static void print_ip_service(struct sockaddr_in *addr, char const *protname,
else buf[size-2-bfsl] = '\0'; else buf[size-2-bfsl] = '\0';
} }
else bfs[size-2-bufl] = '\0'; else bfs[size-2-bufl] = '\0';
} }
} }
strcat(buf, ":"); strcat(buf, ":");
strcat(buf, bfs); strcat(buf, bfs);
...@@ -1186,7 +1186,7 @@ static int udp_info(void) ...@@ -1186,7 +1186,7 @@ static int udp_info(void)
static int udplite_info(void) static int udplite_info(void)
{ {
INFO_GUTS6(_PATH_PROCNET_UDPLITE, _PATH_PROCNET_UDPLITE6, INFO_GUTS6(_PATH_PROCNET_UDPLITE, _PATH_PROCNET_UDPLITE6,
"AF INET (udplite)", udp_do_one, "udpl", "udpl6" ); "AF INET (udplite)", udp_do_one, "udpl", "udpl6" );
} }
...@@ -1213,7 +1213,7 @@ static void raw_do_one(int lnr, const char *line,const char *prot) ...@@ -1213,7 +1213,7 @@ static void raw_do_one(int lnr, const char *line,const char *prot)
"%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X %lX:%lX %X:%lX %lX %d %d %lu %*s\n", "%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X %lX:%lX %X:%lX %lX %d %d %lu %*s\n",
&d, local_addr, &local_port, rem_addr, &rem_port, &state, &d, local_addr, &local_port, rem_addr, &rem_port, &state,
&txq, &rxq, &timer_run, &time_len, &retr, &uid, &timeout, &inode); &txq, &rxq, &timer_run, &time_len, &retr, &uid, &timeout, &inode);
if (num < 10) { if (num < 10) {
fprintf(stderr, _("warning, got bogus raw line.\n")); fprintf(stderr, _("warning, got bogus raw line.\n"));
return; return;
...@@ -1559,7 +1559,7 @@ static int ipx_info(void) ...@@ -1559,7 +1559,7 @@ static int ipx_info(void)
struct sockaddr sa; struct sockaddr sa;
unsigned sport = 0, dport = 0; unsigned sport = 0, dport = 0;
struct stat s; struct stat s;
f = proc_fopen(_PATH_PROCNET_IPX_SOCKET1); f = proc_fopen(_PATH_PROCNET_IPX_SOCKET1);
if (!f) { if (!f) {
if (errno != ENOENT) { if (errno != ENOENT) {
...@@ -2046,18 +2046,18 @@ int main ...@@ -2046,18 +2046,18 @@ int main
if (flag_int + flag_rou + flag_mas + flag_sta > 1) if (flag_int + flag_rou + flag_mas + flag_sta > 1)
usage(); usage();
if ((flag_inet || flag_inet6 || flag_sta) && if ((flag_inet || flag_inet6 || flag_sta) &&
!(flag_tcp || flag_sctp || flag_udp || flag_udplite || flag_raw)) !(flag_tcp || flag_sctp || flag_udp || flag_udplite || flag_raw))
flag_tcp = flag_sctp = flag_udp = flag_udplite = flag_raw = 1; flag_tcp = flag_sctp = flag_udp = flag_udplite = flag_raw = 1;
if ((flag_tcp || flag_sctp || flag_udp || flag_udplite || flag_raw || flag_igmp) && if ((flag_tcp || flag_sctp || flag_udp || flag_udplite || flag_raw || flag_igmp) &&
!(flag_inet || flag_inet6)) !(flag_inet || flag_inet6))
flag_inet = flag_inet6 = 1; flag_inet = flag_inet6 = 1;
if (flag_bluetooth && !(flag_l2cap || flag_rfcomm)) if (flag_bluetooth && !(flag_l2cap || flag_rfcomm))
flag_l2cap = flag_rfcomm = 1; flag_l2cap = flag_rfcomm = 1;
flag_arg = flag_tcp + flag_sctp + flag_udplite + flag_udp + flag_raw + flag_unx flag_arg = flag_tcp + flag_sctp + flag_udplite + flag_udp + flag_raw + flag_unx
+ flag_ipx + flag_ax25 + flag_netrom + flag_igmp + flag_x25 + flag_rose + flag_ipx + flag_ax25 + flag_netrom + flag_igmp + flag_x25 + flag_rose
+ flag_l2cap + flag_rfcomm; + flag_l2cap + flag_rfcomm;
...@@ -2084,7 +2084,7 @@ int main ...@@ -2084,7 +2084,7 @@ int main
if (flag_sta) { if (flag_sta) {
if (!afname[0]) if (!afname[0])
strcpy(afname, DFLT_AF); strcpy(afname, DFLT_AF);
if (!strcmp(afname, "inet")) { if (!strcmp(afname, "inet")) {
#if HAVE_AFINET #if HAVE_AFINET
inittab(); inittab();
...@@ -2105,7 +2105,7 @@ int main ...@@ -2105,7 +2105,7 @@ int main
} }
exit(0); exit(0);
} }
if (flag_rou) { if (flag_rou) {
int options = 0; int options = 0;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
Copyright (c) 1994 John Paul Morrison (VE7JPM). Copyright (c) 1994 John Paul Morrison (VE7JPM).
version 0.2 version 0.2
Changed by Alan Cox, to reflect the way SIOCDEVPRIVATE is meant to work Changed by Alan Cox, to reflect the way SIOCDEVPRIVATE is meant to work
and for the extra parameter added by Niibe. and for the extra parameter added by Niibe.
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* (derived from FvK's 'route.c 1.70 01/04/94') * (derived from FvK's 'route.c 1.70 01/04/94')
* *
* Modifications: * Modifications:
* Johannes Stille: for Net-2Debugged by * Johannes Stille: for Net-2Debugged by
* <johannes@titan.os.open.de> * <johannes@titan.os.open.de>
* Linus Torvalds: Misc Changes * Linus Torvalds: Misc Changes
* Alan Cox: add the new mtu/window stuff * Alan Cox: add the new mtu/window stuff
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* {1.80} Bernd Eckenfels: reject, metric, irtt, 1.2.x support. * {1.80} Bernd Eckenfels: reject, metric, irtt, 1.2.x support.
* {1.81} Bernd Eckenfels: reject routes need a dummy device * {1.81} Bernd Eckenfels: reject routes need a dummy device
*960127 {1.82} Bernd Eckenfels: 'mod' and 'dyn' 'reinstate' added *960127 {1.82} Bernd Eckenfels: 'mod' and 'dyn' 'reinstate' added
*960129 {1.83} Bernd Eckenfels: resolve and getsock now in lib/, *960129 {1.83} Bernd Eckenfels: resolve and getsock now in lib/,
* REJECT displays '-' as gatway. * REJECT displays '-' as gatway.
*960202 {1.84} Bernd Eckenfels: net-features support added *960202 {1.84} Bernd Eckenfels: net-features support added
*960203 {1.85} Bernd Eckenfels: "#ifdef' in '#if' for net-features *960203 {1.85} Bernd Eckenfels: "#ifdef' in '#if' for net-features
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include <limits.h> #include <limits.h>
#include <pwd.h> #include <pwd.h>
#include <signal.h> #include <signal.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <getopt.h> #include <getopt.h>
...@@ -82,7 +82,7 @@ struct { ...@@ -82,7 +82,7 @@ struct {
const char *speed; const char *speed;
int code; int code;
} tty_speeds[] = { /* table of usable baud rates */ } tty_speeds[] = { /* table of usable baud rates */
{ "50", B50 }, { "75", B75 }, { "50", B50 }, { "75", B75 },
{ "110", B110 }, { "300", B300 }, { "110", B110 }, { "300", B300 },
{ "600", B600 }, { "1200", B1200 }, { "600", B600 }, { "1200", B1200 },
{ "2400", B2400 }, { "4800", B4800 }, { "2400", B2400 }, { "4800", B4800 },
...@@ -151,7 +151,7 @@ tty_already_locked(char *nam) ...@@ -151,7 +151,7 @@ tty_already_locked(char *nam)
/* that lock. */ /* that lock. */
i = fscanf(fd, "%d", &pid); i = fscanf(fd, "%d", &pid);
(void) fclose(fd); (void) fclose(fd);
if (i != 1) /* Lock file format's wrong! Kill't */ if (i != 1) /* Lock file format's wrong! Kill't */
return(0); return(0);
...@@ -298,7 +298,7 @@ tty_set_parity(struct termios *tty, char *parity) ...@@ -298,7 +298,7 @@ tty_set_parity(struct termios *tty, char *parity)
switch(toupper(*parity)) { switch(toupper(*parity)) {
case 'N': case 'N':
tty->c_cflag &= ~(PARENB | PARODD); tty->c_cflag &= ~(PARENB | PARODD);
break; break;
case 'O': case 'O':
tty->c_cflag &= ~(PARENB | PARODD); tty->c_cflag &= ~(PARENB | PARODD);
...@@ -347,7 +347,7 @@ tty_set_raw(struct termios *tty) ...@@ -347,7 +347,7 @@ tty_set_raw(struct termios *tty)
tty->c_lflag = (0); /* local flags */ tty->c_lflag = (0); /* local flags */
speed = (tty->c_cflag & CBAUD); /* save current speed */ speed = (tty->c_cflag & CBAUD); /* save current speed */
tty->c_cflag = (HUPCL | CREAD); /* UART flags */ tty->c_cflag = (HUPCL | CREAD); /* UART flags */
if (opt_L) if (opt_L)
tty->c_cflag |= CLOCAL; tty->c_cflag |= CLOCAL;
else else
tty->c_cflag |= CRTSCTS; tty->c_cflag |= CRTSCTS;
...@@ -416,7 +416,7 @@ static int ...@@ -416,7 +416,7 @@ static int
tty_get_name(char *name) tty_get_name(char *name)
{ {
if (ioctl(tty_fd, SIOCGIFNAME, name) < 0) { if (ioctl(tty_fd, SIOCGIFNAME, name) < 0) {
if (opt_q == 0) if (opt_q == 0)
perror("tty_get_name"); perror("tty_get_name");
return(-errno); return(-errno);
} }
...@@ -470,7 +470,7 @@ tty_open(char *name, const char *speed) ...@@ -470,7 +470,7 @@ tty_open(char *name, const char *speed)
if (name != NULL) { if (name != NULL) {
if (name[0] != '/') { if (name[0] != '/') {
if (strlen(name + 6) > sizeof(pathbuf)) { if (strlen(name + 6) > sizeof(pathbuf)) {
if (opt_q == 0) fprintf(stderr, if (opt_q == 0) fprintf(stderr,
_("slattach: tty name too long\n")); _("slattach: tty name too long\n"));
return (-1); return (-1);
} }
...@@ -531,7 +531,7 @@ tty_open(char *name, const char *speed) ...@@ -531,7 +531,7 @@ tty_open(char *name, const char *speed)
if (tty_get_disc(&tty_sdisc) < 0) { if (tty_get_disc(&tty_sdisc) < 0) {
if (opt_q == 0) fprintf(stderr, _("slattach: tty_open: cannot get current line disc!\n")); if (opt_q == 0) fprintf(stderr, _("slattach: tty_open: cannot get current line disc!\n"));
return(-errno); return(-errno);
} }
tty_ldisc = tty_sdisc; tty_ldisc = tty_sdisc;
/* Put this terminal line in a 8-bit transparent mode. */ /* Put this terminal line in a 8-bit transparent mode. */
...@@ -597,7 +597,7 @@ usage(void) ...@@ -597,7 +597,7 @@ usage(void)
} }
static void static void
version(void) version(void)
{ {
printf("%s\n%s\n", Release, Signature); printf("%s\n%s\n", Release, Signature);
...@@ -694,7 +694,7 @@ main(int argc, char *argv[]) ...@@ -694,7 +694,7 @@ main(int argc, char *argv[])
usage(); usage();
/*NOTREACHED*/ /*NOTREACHED*/
} }
if (setvbuf(stdout,0,_IOLBF,0)) { if (setvbuf(stdout,0,_IOLBF,0)) {
if (opt_q == 0) fprintf(stderr, _("slattach: setvbuf(stdout,0,_IOLBF,0) : %s\n"), if (opt_q == 0) fprintf(stderr, _("slattach: setvbuf(stdout,0,_IOLBF,0) : %s\n"),
strerror(errno)); strerror(errno));
......
/* /*
* Copyright 1997,1999,2000 Andi Kleen. Subject to the GPL. * Copyright 1997,1999,2000 Andi Kleen. Subject to the GPL.
* $Id: statistics.c,v 1.23 2010-10-29 19:24:36 ecki Exp $ * $Id: statistics.c,v 1.23 2010-10-29 19:24:36 ecki Exp $
* 19980630 - i18n - Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 19980630 - i18n - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* 19981113 - i18n fixes - Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 19981113 - i18n fixes - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* 19990101 - added net/netstat, -t, -u, -w supprt - Bernd Eckenfels * 19990101 - added net/netstat, -t, -u, -w supprt - Bernd Eckenfels
*/ */
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
...@@ -36,26 +36,26 @@ struct entry { ...@@ -36,26 +36,26 @@ struct entry {
enum State type; enum State type;
}; };
struct statedesc { struct statedesc {
int indent; int indent;
char *title; char *title;
}; };
struct statedesc states[] = { struct statedesc states[] = {
[number] = { 4, NULL }, [number] = { 4, NULL },
[opt_number] = { 4, NULL }, [opt_number] = { 4, NULL },
[i_forward] = { 4, NULL }, [i_forward] = { 4, NULL },
[i_inp_icmp] = { 8, N_("ICMP input histogram:") }, [i_inp_icmp] = { 8, N_("ICMP input histogram:") },
[i_outp_icmp] = { 8, N_("ICMP output histogram:") }, [i_outp_icmp] = { 8, N_("ICMP output histogram:") },
[MaxState] = {0}, [MaxState] = {0},
}; };
static enum State state; static enum State state;
#define I_STATIC (1<<16) /* static configuration option. */ #define I_STATIC (1<<16) /* static configuration option. */
#define I_TITLE (1<<17) #define I_TITLE (1<<17)
/* /*
* XXX check against the snmp mib rfc. * XXX check against the snmp mib rfc.
* *
* Don't mark the first field as translatable! It's a snmp MIB standard. * Don't mark the first field as translatable! It's a snmp MIB standard.
...@@ -218,19 +218,19 @@ struct entry Tcpexttab[] = ...@@ -218,19 +218,19 @@ struct entry Tcpexttab[] =
{"SyncookiesFailed", N_("%llu invalid SYN cookies received"), opt_number}, {"SyncookiesFailed", N_("%llu invalid SYN cookies received"), opt_number},
{ "EmbryonicRsts", N_("%llu resets received for embryonic SYN_RECV sockets"), { "EmbryonicRsts", N_("%llu resets received for embryonic SYN_RECV sockets"),
opt_number }, opt_number },
{ "PruneCalled", N_("%llu packets pruned from receive queue because of socket" { "PruneCalled", N_("%llu packets pruned from receive queue because of socket"
" buffer overrun"), opt_number }, " buffer overrun"), opt_number },
/* obsolete: 2.2.0 doesn't do that anymore */ /* obsolete: 2.2.0 doesn't do that anymore */
{ "RcvPruned", N_("%llu packets pruned from receive queue"), opt_number }, { "RcvPruned", N_("%llu packets pruned from receive queue"), opt_number },
{ "OfoPruned", N_("%llu packets dropped from out-of-order queue because of" { "OfoPruned", N_("%llu packets dropped from out-of-order queue because of"
" socket buffer overrun"), opt_number }, " socket buffer overrun"), opt_number },
{ "OutOfWindowIcmps", N_("%llu ICMP packets dropped because they were " { "OutOfWindowIcmps", N_("%llu ICMP packets dropped because they were "
"out-of-window"), opt_number }, "out-of-window"), opt_number },
{ "LockDroppedIcmps", N_("%llu ICMP packets dropped because" { "LockDroppedIcmps", N_("%llu ICMP packets dropped because"
" socket was locked"), opt_number }, " socket was locked"), opt_number },
{ "TW", N_("%llu TCP sockets finished time wait in fast timer"), opt_number }, { "TW", N_("%llu TCP sockets finished time wait in fast timer"), opt_number },
{ "TWRecycled", N_("%llu time wait sockets recycled by time stamp"), opt_number }, { "TWRecycled", N_("%llu time wait sockets recycled by time stamp"), opt_number },
{ "TWKilled", N_("%llu TCP sockets finished time wait in slow timer"), opt_number }, { "TWKilled", N_("%llu TCP sockets finished time wait in slow timer"), opt_number },
{ "PAWSPassive", N_("%llu passive connections rejected because of" { "PAWSPassive", N_("%llu passive connections rejected because of"
" time stamp"), opt_number }, " time stamp"), opt_number },
...@@ -254,8 +254,8 @@ struct entry Tcpexttab[] = ...@@ -254,8 +254,8 @@ struct entry Tcpexttab[] =
{ "TCPHPHits", N_("%llu packet headers predicted"), number }, { "TCPHPHits", N_("%llu packet headers predicted"), number },
{ "TCPHPHitsToUser", N_("%llu packets header predicted and " { "TCPHPHitsToUser", N_("%llu packets header predicted and "
"directly queued to user"), opt_number }, "directly queued to user"), opt_number },
{ "SockMallocOOM", N_("Ran %llu times out of system memory during " { "SockMallocOOM", N_("Ran %llu times out of system memory during "
"packet sending"), opt_number }, "packet sending"), opt_number },
{ "TCPPureAcks", N_("%llu acknowledgments not containing data payload received"), opt_number }, { "TCPPureAcks", N_("%llu acknowledgments not containing data payload received"), opt_number },
{ "TCPHPAcks", N_("%llu predicted acknowledgments"), opt_number }, { "TCPHPAcks", N_("%llu predicted acknowledgments"), opt_number },
{ "TCPRenoRecovery", N_("%llu times recovered from packet loss due to fast retransmit"), opt_number }, { "TCPRenoRecovery", N_("%llu times recovered from packet loss due to fast retransmit"), opt_number },
...@@ -303,7 +303,7 @@ struct tabtab { ...@@ -303,7 +303,7 @@ struct tabtab {
char *title; char *title;
struct entry *tab; struct entry *tab;
size_t size; size_t size;
int *flag; int *flag;
}; };
struct tabtab snmptabs[] = struct tabtab snmptabs[] =
...@@ -339,11 +339,11 @@ void printval(struct tabtab *tab, char *title, unsigned long long val) ...@@ -339,11 +339,11 @@ void printval(struct tabtab *tab, char *title, unsigned long long val)
char buf[512]; char buf[512];
key.title = title; key.title = title;
if (tab->tab) if (tab->tab)
ent = bsearch(&key, tab->tab, tab->size / sizeof(struct entry), ent = bsearch(&key, tab->tab, tab->size / sizeof(struct entry),
sizeof(struct entry), cmpentries); sizeof(struct entry), cmpentries);
if (!ent) { /* try our best */ if (!ent) { /* try our best */
if (val) if (val)
printf("%*s%s: %llu\n", states[state].indent, "", title, val); printf("%*s%s: %llu\n", states[state].indent, "", title, val);
return; return;
} }
...@@ -364,7 +364,7 @@ void printval(struct tabtab *tab, char *title, unsigned long long val) ...@@ -364,7 +364,7 @@ void printval(struct tabtab *tab, char *title, unsigned long long val)
buf[0] = '\0'; buf[0] = '\0';
switch (type) { switch (type) {
case opt_number: case opt_number:
if (val == 0) if (val == 0)
break; break;
/*FALL THOUGH*/ /*FALL THOUGH*/
case number: case number:
...@@ -394,7 +394,7 @@ struct tabtab *newtable(struct tabtab *tabs, char *title) ...@@ -394,7 +394,7 @@ struct tabtab *newtable(struct tabtab *tabs, char *title)
{ {
struct tabtab *t; struct tabtab *t;
static struct tabtab dummytab; static struct tabtab dummytab;
for (t = tabs; t->title; t++) { for (t = tabs; t->title; t++) {
if (!strcmp(title, t->title)) { if (!strcmp(title, t->title)) {
if (*(t->flag)) if (*(t->flag))
...@@ -403,11 +403,11 @@ struct tabtab *newtable(struct tabtab *tabs, char *title) ...@@ -403,11 +403,11 @@ struct tabtab *newtable(struct tabtab *tabs, char *title)
return t; return t;
} }
} }
if (!f_unknown) if (!f_unknown)
return NULL; return NULL;
printf("%s:\n", _(title)); printf("%s:\n", _(title));
dummytab.title = title; dummytab.title = title;
dummytab.flag = &f_unknown; dummytab.flag = &f_unknown;
return &dummytab; return &dummytab;
} }
...@@ -421,7 +421,7 @@ int process_fd(FILE *f, int all, char *filter) ...@@ -421,7 +421,7 @@ int process_fd(FILE *f, int all, char *filter)
if (buf1[0] == '\n') // skip empty first line in 2.6 kernels if (buf1[0] == '\n') // skip empty first line in 2.6 kernels
continue; continue;
if (!fgets(buf2, sizeof buf2, f)) if (!fgets(buf2, sizeof buf2, f))
break; break;
sp = strchr(buf1, ':'); sp = strchr(buf1, ':');
...@@ -444,8 +444,8 @@ int process_fd(FILE *f, int all, char *filter) ...@@ -444,8 +444,8 @@ int process_fd(FILE *f, int all, char *filter)
endflag = 0; endflag = 0;
while (!endflag) { while (!endflag) {
sp += strspn(sp, " \t\n"); sp += strspn(sp, " \t\n");
np += strspn(np, " \t\n"); np += strspn(np, " \t\n");
/*if (*np == '\0') goto formaterr; */ /*if (*np == '\0') goto formaterr; */
p = sp+strcspn(sp, " \t\n"); p = sp+strcspn(sp, " \t\n");
...@@ -453,14 +453,14 @@ int process_fd(FILE *f, int all, char *filter) ...@@ -453,14 +453,14 @@ int process_fd(FILE *f, int all, char *filter)
endflag = 1; endflag = 1;
*p = '\0'; *p = '\0';
if (*sp != '\0' && *(tab->flag)) if (*sp != '\0' && *(tab->flag))
printval(tab, sp, strtoull(np, &np, 10)); printval(tab, sp, strtoull(np, &np, 10));
sp = p + 1; sp = p + 1;
} }
} }
return 0; return 0;
formaterr: formaterr:
return -1; return -1;
} }
...@@ -507,7 +507,7 @@ void parsesnmp(int flag_raw, int flag_tcp, int flag_udp) ...@@ -507,7 +507,7 @@ void parsesnmp(int flag_raw, int flag_tcp, int flag_udp)
FILE *f; FILE *f;
f_raw = flag_raw; f_tcp = flag_tcp; f_udp = flag_udp; f_raw = flag_raw; f_tcp = flag_tcp; f_udp = flag_udp;
f = proc_fopen("/proc/net/snmp"); f = proc_fopen("/proc/net/snmp");
if (!f) { if (!f) {
perror(_("cannot open /proc/net/snmp")); perror(_("cannot open /proc/net/snmp"));
...@@ -530,12 +530,12 @@ void parsesnmp(int flag_raw, int flag_tcp, int flag_udp) ...@@ -530,12 +530,12 @@ void parsesnmp(int flag_raw, int flag_tcp, int flag_udp)
if (ferror(f)) if (ferror(f))
perror("/proc/net/netstat"); perror("/proc/net/netstat");
fclose(f); fclose(f);
} }
return; return;
} }
void parsesnmp6(int flag_raw, int flag_tcp, int flag_udp) void parsesnmp6(int flag_raw, int flag_tcp, int flag_udp)
{ {
FILE *f; FILE *f;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment