From a1de64793a9420bddf4dff308a244c5d2cb52d1b Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Fri, 20 Jan 2012 13:52:12 +0100 Subject: Removed SET and GET of interface metrics https://sourceforge.net/mailarchive/message.php?msg_id=28701120 --- ifconfig.c | 15 ++------------- include/interface.h | 1 - lib/interface.c | 14 ++++---------- man/de_DE/ifconfig.8 | 3 --- man/en_US/ifconfig.8 | 3 --- man/fr_FR/ifconfig.8 | 4 ---- man/pt_BR/ifconfig.8 | 4 ---- netstat.c | 2 +- 8 files changed, 7 insertions(+), 39 deletions(-) diff --git a/ifconfig.c b/ifconfig.c index dae8922..be69995 100644 --- a/ifconfig.c +++ b/ifconfig.c @@ -104,7 +104,7 @@ static int if_print(char *ifname) 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 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); @@ -212,7 +212,7 @@ static void usage(void) #ifdef SIOCSKEEPALIVE fprintf(stderr, _(" [outfill ] [keepalive ]\n")); #endif - fprintf(stderr, _(" [hw
] [metric ] [mtu ]\n")); + fprintf(stderr, _(" [hw
] [mtu ]\n")); fprintf(stderr, _(" [[-]trailers] [[-]arp] [[-]allmulti]\n")); fprintf(stderr, _(" [multicast] [[-]promisc]\n")); fprintf(stderr, _(" [mem_start ] [io_addr ] [irq ] [media ]\n")); @@ -471,17 +471,6 @@ int main(int argc, char **argv) } #endif - if (!strcmp(*spp, "metric")) { - if (*++spp == NULL) - usage(); - ifr.ifr_metric = atoi(*spp); - if (ioctl(skfd, SIOCSIFMETRIC, &ifr) < 0) { - fprintf(stderr, "SIOCSIFMETRIC: %s\n", strerror(errno)); - goterr = 1; - } - spp++; - continue; - } if (!strcmp(*spp, "mtu")) { if (*++spp == NULL) usage(); diff --git a/include/interface.h b/include/interface.h index afc1297..f238f5f 100644 --- a/include/interface.h +++ b/include/interface.h @@ -32,7 +32,6 @@ struct interface { char name[IFNAMSIZ]; /* interface name */ short type; /* if type */ short flags; /* various flags */ - int metric; /* routing metric */ int mtu; /* MTU value */ int tx_queue_len; /* transmit queue length */ struct ifmap map; /* hardware setup */ diff --git a/lib/interface.c b/lib/interface.c index 276c5f5..2f35a14 100644 --- a/lib/interface.c +++ b/lib/interface.c @@ -427,12 +427,6 @@ int if_fetch(struct interface *ife) ife->type = ifr.ifr_hwaddr.sa_family; - strcpy(ifr.ifr_name, ifname); - if (ioctl(skfd, SIOCGIFMETRIC, &ifr) < 0) - ife->metric = 0; - else - ife->metric = ifr.ifr_metric; - strcpy(ifr.ifr_name, ifname); if (ioctl(skfd, SIOCGIFMTU, &ifr) < 0) ife->mtu = 0; @@ -599,8 +593,8 @@ int do_if_print(struct interface *ife, void *cookie) void ife_print_short(struct interface *ptr) { - printf("%-5.5s ", ptr->name); - printf("%5d %-2d ", ptr->mtu, ptr->metric); + printf("%-8.8s ", ptr->name); + printf("%5d ", ptr->mtu); /* If needed, display the interface statistics. */ if (ptr->statistics_valid) { printf("%8llu %6lu %6lu %-6lu ", @@ -734,8 +728,8 @@ void ife_print_long(struct interface *ptr) flags[strlen(flags)-1] = 0; - printf(_("%s: %s mtu %d metric %d"), - ptr->name, flags, ptr->mtu, ptr->metric ? ptr->metric : 1); + printf(_("%s: %s mtu %d"), + ptr->name, flags, ptr->mtu); #ifdef SIOCSKEEPALIVE if (ptr->outfill || ptr->keepalive) printf(_(" outfill %d keepalive %d"), diff --git a/man/de_DE/ifconfig.8 b/man/de_DE/ifconfig.8 index df102d1..9713965 100644 --- a/man/de_DE/ifconfig.8 +++ b/man/de_DE/ifconfig.8 @@ -73,9 +73,6 @@ Modus. Ist er eingeschaltet, so werden alle Multicastpakete vom Netzwerk empfangen unabh\(:angig davon, ob sie an die Schnittstelle adressiert sind oder nicht. .TP -.B "metric N" -Dieses Argument setzt den Metrik-Wert f\(:ur die Schnittstelle auf N. -.TP .B "mtu N" Dieses Argument setzt die Maximum Transfer Unit (MTU) der Schnittstelle, das ist das gr\(:o\(sste Paket, dass gesendet werden kann. diff --git a/man/en_US/ifconfig.8 b/man/en_US/ifconfig.8 index de5a0e8..0243be3 100644 --- a/man/en_US/ifconfig.8 +++ b/man/en_US/ifconfig.8 @@ -90,9 +90,6 @@ Enable or disable mode. If selected, all multicast packets on the network will be received by the interface. .TP -.B "metric N" -This parameter sets the interface metric. -.TP .B "mtu N" This parameter sets the Maximum Transfer Unit (MTU) of an interface. .TP diff --git a/man/fr_FR/ifconfig.8 b/man/fr_FR/ifconfig.8 index 18d7a1d..5f8edaa 100644 --- a/man/fr_FR/ifconfig.8 +++ b/man/fr_FR/ifconfig.8 @@ -70,10 +70,6 @@ Valide ou invalide le fonctionnement de l'interface en mode S'il est validé, tous les paquets multicast circulant sur le réseau seront reçus sur cette interface. .TP -.B "metric N" -Ce paramètre définit la métrique de l'interface. Il n'est pour -l'instant pas implémenté, mais le sera prochainement. -.TP .B "mtu N" Ce paramètre définit le MTU (Maximum Transfer Unit) d'une interface. diff --git a/man/pt_BR/ifconfig.8 b/man/pt_BR/ifconfig.8 index 296469c..1432dc5 100644 --- a/man/pt_BR/ifconfig.8 +++ b/man/pt_BR/ifconfig.8 @@ -69,10 +69,6 @@ Habilita ou desabilita o modo da interface. Isto significa que todos os frames passarão pela camada de rede do kernel, permitindo monitoração da rede. .TP -.B "metric N" -Este parâmetro configura a métrica da interface. Não é usado atualmente, -mas será implementado no futuro. -.TP .B "mtu N" Este parâmetro configura a Unidade Máxima de Transferência (MTU) de uma interface. Para Ethernet é um número entre 1000-2000 (o padrão é diff --git a/netstat.c b/netstat.c index e080b06..2ff4bc8 100644 --- a/netstat.c +++ b/netstat.c @@ -1794,7 +1794,7 @@ static int iface_info(void) } if (flag_exp < 2) { ife_short = 1; - 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 RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n")); } if (for_all_interfaces(do_if_print, &flag_all) < 0) { -- cgit v1.2.3