* that either displays or sets the characteristics of
* one or more of the system's networking interfaces.
*
- * Version: $Id: ifconfig.c,v 1.56 2002/07/05 17:36:02 ecki Exp $
+ * Version: $Id: ifconfig.c,v 1.57 2002/12/10 00:56:41 ecki Exp $
*
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* and others. Copyright 1993 MicroWalt Corporation
int res;
if (ife_short)
- printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
+ printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
if (!ifname) {
res = for_all_interfaces(do_if_print, &opt_a);
if (*++spp != NULL) {
safe_strncpy(host, *spp, (sizeof host));
if (ap->input(0, host, &sa) < 0) {
- ap->herror(host);
+ if (ap->herror)
+ ap->herror(host);
+ else
+ fprintf(stderr, _("ifconfig: Error resolving '%s' for broadcast\n"), host);
goterr = 1;
spp++;
continue;
usage();
safe_strncpy(host, *spp, (sizeof host));
if (ap->input(0, host, &sa) < 0) {
- ap->herror(host);
+ if (ap->herror)
+ ap->herror(host);
+ else
+ fprintf(stderr, _("ifconfig: Error resolving '%s' for dstaddr\n"), host);
goterr = 1;
spp++;
continue;
usage();
safe_strncpy(host, *spp, (sizeof host));
if (ap->input(0, host, &sa) < 0) {
- ap->herror(host);
+ if (ap->herror)
+ ap->herror(host);
+ else
+ fprintf(stderr, _("ifconfig: Error resolving '%s' for netmask\n"), host);
goterr = 1;
spp++;
continue;
spp++;
safe_strncpy(host, *spp, (sizeof host));
if (ap->input(0, host, &sa)) {
- ap->herror(host);
+ if (ap->herror)
+ ap->herror(host);
+ else
+ fprintf(stderr, _("ifconfig: Error resolving '%s' for pointopoint\n"), host);
goterr = 1;
spp++;
continue;
usage();
*cp = 0;
} else {
- prefix_len = 0;
+ prefix_len = 128;
}
safe_strncpy(host, *spp, (sizeof host));
if (inet6_aftype.input(1, host,
(struct sockaddr *) &sa6) < 0) {
- inet6_aftype.herror(host);
+ if (inet6_aftype.herror)
+ inet6_aftype.herror(host);
+ else
+ fprintf(stderr, _("ifconfig: Error resolving '%s' for add\n"), host);
goterr = 1;
spp++;
continue;
usage();
*cp = 0;
} else {
- prefix_len = 0;
+ prefix_len = 128;
}
safe_strncpy(host, *spp, (sizeof host));
if (inet6_aftype.input(1, host,
}
ifr6.ifr6_ifindex = ifr.ifr_ifindex;
ifr6.ifr6_prefixlen = prefix_len;
+ if (opt_v)
+ fprintf(stderr, "now deleting: ioctl(SIOCDIFADDR,{ifindex=%d,prefixlen=%ld})\n",ifr.ifr_ifindex,prefix_len);
if (ioctl(fd, SIOCDIFADDR, &ifr6) < 0) {
fprintf(stderr, "SIOCDIFADDR: %s\n",
strerror(errno));
usage();
*cp = 0;
} else {
- prefix_len = 0;
+ prefix_len = 128;
}
safe_strncpy(host, *spp, (sizeof host));
if (inet6_aftype.input(1, host, (struct sockaddr *) &sa6) < 0) {
exit(1);
}
if (ap->input(0, host, &sa) < 0) {
- ap->herror(host);
- fprintf(stderr, _("ifconfig: `--help' gives usage information.\n"));
- exit(1);
+ if (ap->herror)
+ ap->herror(host);
+ else
+ fprintf(stderr,_("ifconfig: error resolving '%s' to set address for af=%s\n"), host, ap->name); fprintf(stderr,
+ _("ifconfig: `--help' gives usage information.\n")); exit(1);
}
memcpy((char *) &ifr.ifr_addr, (char *) &sa, sizeof(struct sockaddr));
{
8/2000 Andi Kleen make the list operations a bit more efficient.
People are crazy enough to use thousands of aliases now.
- $Id: interface.c,v 1.26 2002/12/05 22:10:32 ecki Exp $
+ $Id: interface.c,v 1.27 2002/12/10 00:56:41 ecki Exp $
*/
#include "config.h"
void ife_print_short(struct interface *ptr)
{
printf("%-5.5s ", ptr->name);
- printf("%5d %-2d", ptr->mtu, ptr->metric);
+ printf("%5d %-2d ", ptr->mtu, ptr->metric);
/* If needed, display the interface statistics. */
if (ptr->statistics_valid) {
- printf("%9llu %6lu %6lu %-5lu",
+ printf("%8llu %6lu %6lu %-6lu ",
ptr->stats.rx_packets, ptr->stats.rx_errors,
ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors);
- printf("%9llu %6lu %6lu %6lu ",
+ printf("%8llu %6lu %6lu %6lu ",
ptr->stats.tx_packets, ptr->stats.tx_errors,
ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors);
} else {