Commit 1bbe9c59 authored by Klaas Freitag's avatar Klaas Freitag

Add txqueuelen argument to ifconfig.

Some libc5 fixes.

Note that it isn't tested yet, because I still don't have a kernel
with a working SIOCGIFFTXQLEN.
parent 1ef3bd3b
......@@ -38,6 +38,7 @@
#if HAVE_AFINET6
#ifndef _LINUX_IN6_H
/*
* This is in linux/include/net/ipv6.h.
*/
......@@ -48,6 +49,8 @@ struct in6_ifreq {
unsigned int ifr6_ifindex;
};
#endif
#define IPV6_ADDR_ANY 0x0000U
#define IPV6_ADDR_UNICAST 0x0001U
......@@ -72,6 +75,12 @@ struct in6_ifreq {
#define IFF_AUTOMEDIA 0x4000
#endif
#ifndef SIOCSIFTXQLEN /* 2.1.77+ option */
#define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */
#define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */
#define ifr_qlen ifr_ifru.ifru_ivalue /* Queue length */
#endif
/* This is from <linux/netdevice.h>. */
struct user_net_device_stats
......@@ -108,6 +117,7 @@ struct interface {
short flags; /* various flags */
int metric; /* routing metric */
int mtu; /* MTU value */
int tx_queue_len; /* transmit queue length */
struct ifmap map; /* hardware setup */
struct sockaddr addr; /* IP address */
struct sockaddr dstaddr; /* P-P IP address */
......@@ -161,7 +171,7 @@ static const char *if_port_text[][4] = {
#include "net-locale.h"
char *Release = RELEASE,
*Version = "ifconfig 1.30 (1998-01-02)";
*Version = "ifconfig 1.30 ($Id)";
int opt_a = 0; /* show all interfaces */
int opt_i = 0; /* show the statistics */
......@@ -333,7 +343,10 @@ ife_print(struct interface *ptr)
if (ptr->flags & IFF_MULTICAST) printf("MULTICAST ");
printf(NLS_CATGETS(catfd, ifconfigSet, ifconfig_mtu, " MTU:%d Metric:%d\n"),
ptr->mtu, ptr->metric?ptr->metric:1);
/* XXX: Merge this with the previous line, but I don't want to touch the
* NLS stuff yet. */
if (ptr->tx_queue_len != -1)
printf("TXQUEUELEN: %d\n", ptr->tx_queue_len);
/* If needed, display the interface statistics. */
printf(" ");
......@@ -497,6 +510,12 @@ if_fetch(char *ifname, struct interface *ife)
else
ife->map = ifr.ifr_map;
strcpy(ifr.ifr_name, ifname);
if (ioctl(skfd, SIOCGIFTXQLEN, &ifr) < 0)
ife->tx_queue_len = -1; /* unknown value */
else
ife->tx_queue_len = ifr.ifr_qlen;
#if HAVE_AFINET
strcpy(ifr.ifr_name, ifname);
if (inet_sock < 0 || ioctl(inet_sock, SIOCGIFDSTADDR, &ifr) < 0)
......@@ -689,6 +708,7 @@ usage(void)
fprintf(stderr, " [multicast]\n");
fprintf(stderr, " [mem_start NN] [io_addr NN] [irq NN]\n");
fprintf(stderr, " [media type]\n");
fprintf(stderr, " [txqueuelen len]\n");
fprintf(stderr, " [up] [down] ...\n");
NLS_CATCLOSE(catfd)
exit(1);
......@@ -1027,6 +1047,17 @@ main(int argc, char **argv)
continue;
}
if (!strcmp(*spp, "txqueuelen")) {
if (*++spp == NULL) usage();
ifr.ifr_qlen = strtoul(*spp, NULL, 0);
if (ioctl(skfd, SIOCSIFTXQLEN, &ifr) < 0) {
fprintf(stderr, "SIOCSIFTXQLEN: %s\n", strerror(errno));
goterr = 1;
}
spp++;
continue;
}
if (!strcmp(*spp, "mem_start")) {
if (*++spp == NULL) usage();
if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0) {
......
......@@ -161,6 +161,12 @@ as the drivers set the flag correctly themselves.
.TP
.B address
The IP address to be assigned to this interface.
.TP
.B txqueuelen length
Set the length of the transmit queue of the device. It is useful to set this
to small values for slower devices with a high latency (modem links, ISDN)
to prevent fast bulk transfers from disturbing interactive traffic like
telnet too much.
.SH FILES
.I /proc/net/socket
.br
......
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