diff -Naur busybox-1.8.2_org/include/libbb.h busybox-1.8.2/include/libbb.h --- busybox-1.8.2_org/include/libbb.h 2007-11-10 02:40:53.000000000 +0100 +++ busybox-1.8.2/include/libbb.h 2008-07-15 09:46:40.000000000 +0200 @@ -345,6 +345,7 @@ * If there is no suffix, port argument is used */ int create_and_connect_stream_or_die(const char *peer, int port); /* Connect to peer identified by lsa */ +int xconnect_stream_with_tc_index(const len_and_sockaddr *lsa, unsigned long tc_index); /* AVM */ int xconnect_stream(const len_and_sockaddr *lsa); /* Return malloc'ed len_and_sockaddr with socket address of host:port * Currently will return IPv4 or IPv6 sockaddrs only diff -Naur busybox-1.8.2_org/include/usage.h busybox-1.8.2/include/usage.h --- busybox-1.8.2_org/include/usage.h 2007-11-10 02:40:53.000000000 +0100 +++ busybox-1.8.2/include/usage.h 2008-07-15 09:50:41.000000000 +0200 @@ -4073,11 +4073,11 @@ USE_GETOPT_LONG( \ "[-c|--continue] [-s|--spider] [-q|--quiet] [-O|--output-document file]\n" \ " [--header 'header: value'] [-Y|--proxy on/off] [-P DIR]\n" \ - " [-U|--user-agent agent] url" \ + " [-U|--user-agent agent] [-t|--traffic-class class] url" \ ) \ SKIP_GETOPT_LONG( \ - "[-csq] [-O file] [-Y on/off] [-P DIR] [-U agent] url" \ - ) + "[-csq] [-O file] [-Y on/off] [-P DIR] [-U agent] [-t class] url" \ + ) #define wget_full_usage \ "Retrieve files via HTTP or FTP" \ "\n\nOptions:\n" \ @@ -4087,7 +4087,8 @@ " -P Set directory prefix to DIR\n" \ " -O Save to filename ('-' for stdout)\n" \ " -U Adjust 'User-Agent' field\n" \ - " -Y Use proxy ('on' or 'off')" + " -Y Use proxy ('on' or 'off')\n" \ + " -t Traffic class" #define which_trivial_usage \ "[COMMAND ...]" diff -Naur busybox-1.8.2_org/libbb/xconnect.c busybox-1.8.2/libbb/xconnect.c --- busybox-1.8.2_org/libbb/xconnect.c 2007-11-10 02:40:52.000000000 +0100 +++ busybox-1.8.2/libbb/xconnect.c 2008-07-15 09:46:40.000000000 +0200 @@ -360,3 +360,32 @@ { return sockaddr2str(sa, NI_NUMERICHOST | IGNORE_PORT); } + +#if 1 /* AVM */ +/* #include */ /* SIOCSET_TC_INDEX */ +#include +#define SIOCSET_TC_INDEX 0x89d0 + +int xconnect_stream_with_tc_index(const len_and_sockaddr *lsa, unsigned long tc_index) +{ + int fd = xsocket(lsa->sa.sa_family, SOCK_STREAM, 0); + ioctl(fd, SIOCSET_TC_INDEX, &tc_index); + xconnect(fd, &lsa->sa, lsa->len); + return fd; +} + +int xconnect_with_tc_index(struct sockaddr_in *s_addr, unsigned long tc_index) +{ + int s = socket(AF_INET, SOCK_STREAM, 0); + + ioctl(s, SIOCSET_TC_INDEX, &tc_index); + + if (connect(s, (struct sockaddr *)s_addr, sizeof(struct sockaddr_in)) < 0) + { + if (ENABLE_FEATURE_CLEAN_UP) close(s); + bb_perror_msg_and_die("Unable to connect to remote host (%s)", + inet_ntoa(s_addr->sin_addr)); + } + return s; +} +#endif /* AVM */ diff -Naur busybox-1.8.2_org/Makefile busybox-1.8.2/Makefile --- busybox-1.8.2_org/Makefile 2007-11-24 05:31:36.000000000 +0100 +++ busybox-1.8.2/Makefile 2008-07-15 09:46:40.000000000 +0200 @@ -276,7 +276,7 @@ AS = $(CROSS_COMPILE)as CC = $(CROSS_COMPILE)gcc -LD = $(CC) -nostdlib +LD = $(CC) -nostdlib CPP = $(CC) -E AR = $(CROSS_COMPILE)ar NM = $(CROSS_COMPILE)nm @@ -301,10 +301,10 @@ # Use LINUXINCLUDE when you must reference the include/ directory. # Needed to be compatible with the O= option -CFLAGS := $(CFLAGS) -CPPFLAGS := $(CPPFLAGS) -AFLAGS := $(AFLAGS) -LDFLAGS := $(LDFLAGS) +CFLAGS := $(EXTRA_C_FLAGS) $(CFLAGS) +CPPFLAGS := $(EXTRA_CPP_FLAGS) $(CPPFLAGS) +AFLAGS := $(EXTRA_AFLAGS) $(AFLAGS) +LDFLAGS := $(EXTRA_LDFLAGS) $(LDFLAGS) LDLIBS := # Read KERNELRELEASE from .kernelrelease (if it exists) @@ -571,7 +571,7 @@ cmd_busybox__ ?= $(srctree)/scripts/trylink \ "$@" \ "$(CC)" \ - "$(LDFLAGS) $(EXTRA_LDFLAGS)" \ + "$(LDFLAGS)" \ "$(core-y)" \ "$(libs-y)" \ "$(LDLIBS)" @@ -1261,7 +1261,7 @@ a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) \ $(NOSTDINC_FLAGS) $(CPPFLAGS) \ - $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) + $(modkern_aflags) $(AFLAGS_$(*F).o) quiet_cmd_as_o_S = AS $@ cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< diff -Naur busybox-1.8.2_org/networking/wget.c busybox-1.8.2/networking/wget.c --- busybox-1.8.2_org/networking/wget.c 2007-11-10 02:40:47.000000000 +0100 +++ busybox-1.8.2/networking/wget.c 2008-07-15 09:52:47.000000000 +0200 @@ -243,15 +243,23 @@ #endif -static FILE *open_socket(len_and_sockaddr *lsa) +static FILE *open_socket_with_tc_index(len_and_sockaddr *lsa, unsigned long tc_index) /* AVM */ { FILE *fp; /* glibc 2.4 seems to try seeking on it - ??! */ /* hopefully it understands what ESPIPE means... */ - fp = fdopen(xconnect_stream(lsa), "r+"); - if (fp == NULL) - bb_perror_msg_and_die("fdopen"); + if (tc_index) { + fp = fdopen(xconnect_stream_with_tc_index(lsa, tc_index), "r+"); + } else { + fp = fdopen(xconnect_stream(lsa), "r+"); + } + + /*fp = fdopen(xconnect_stream(lsa), "r+"); AVM */ + + if (fp == NULL) { + bb_perror_msg_and_die("fdopen"); + } return fp; } @@ -404,6 +412,8 @@ char *str; char *proxy = 0; char *dir_prefix = NULL; + char *settcclass=NULL; /* AVM */ + unsigned long tc_index; /* AVM */ #if ENABLE_FEATURE_WGET_LONG_OPTIONS char *extra_headers = NULL; llist_t *headers_llist = NULL; @@ -430,8 +440,9 @@ WGET_OPT_PREFIX = 0x10, WGET_OPT_PROXY = 0x20, WGET_OPT_USER_AGENT = 0x40, - WGET_OPT_PASSIVE = 0x80, - WGET_OPT_HEADER = 0x100, + WGET_OPT_TRAFFICCLASS = 0x80, + WGET_OPT_PASSIVE = 0x100, + WGET_OPT_HEADER = 0x200, }; #if ENABLE_FEATURE_WGET_LONG_OPTIONS static const char wget_longopts[] ALIGN1 = @@ -443,6 +454,7 @@ "directory-prefix\0" Required_argument "P" "proxy\0" Required_argument "Y" "user-agent\0" Required_argument "U" + "traffic-class\0" Required_argument "t" /* AVM */ "passive-ftp\0" No_argument "\xff" "header\0" Required_argument "\xfe" ; @@ -455,10 +467,11 @@ #endif /* server.allocated = target.allocated = NULL; */ opt_complementary = "-1" USE_FEATURE_WGET_LONG_OPTIONS(":\xfe::"); - opt = getopt32(argv, "csqO:P:Y:U:", + opt = getopt32(argv, "csqO:P:Y:U:t:", &fname_out, &dir_prefix, - &proxy_flag, &user_agent - USE_FEATURE_WGET_LONG_OPTIONS(, &headers_llist) + &proxy_flag, &user_agent, + &settcclass + USE_FEATURE_WGET_LONG_OPTIONS(, &headers_llist) ); if (strcmp(proxy_flag, "off") == 0) { /* Use the proxy if necessary */ @@ -552,7 +565,13 @@ /* Open socket to http server */ if (sfp) fclose(sfp); - sfp = open_socket(lsa); + + tc_index = 0; /* AVM */ + if (opt & WGET_OPT_TRAFFICCLASS) { /* AVM */ + tc_index = atoi(settcclass); /* AVM */ + } /* AVM */ + sfp = open_socket_with_tc_index(lsa, tc_index); /* AVM */ + /*sfp = open_socket(lsa); AVM */ /* Send HTTP request. */ if (use_proxy) { @@ -668,7 +687,12 @@ if (!target.user) target.user = xstrdup("anonymous:busybox@"); - sfp = open_socket(lsa); + tc_index = 0; /* AVM */ + if (opt & WGET_OPT_TRAFFICCLASS) { /* AVM */ + tc_index = atoi(settcclass); /* AVM */ + } /* AVM */ + sfp = open_socket_with_tc_index(lsa, tc_index); /* AVM */ + /*sfp = open_socket(lsa); AVM */ if (ftpcmd(NULL, NULL, sfp, buf) != 220) bb_error_msg_and_die("%s", buf+4); @@ -723,7 +747,13 @@ if (!str) goto pasv_error; port += xatou_range(str+1, 0, 255) * 256; set_nport(lsa, htons(port)); - dfp = open_socket(lsa); + + tc_index = 0; /* AVM */ + if (opt & WGET_OPT_TRAFFICCLASS) { /* AVM */ + tc_index = atoi(settcclass); /* AVM */ + } /* AVM */ + dfp = open_socket_with_tc_index(lsa, tc_index); /* AVM */ + /*dfp = open_socket(lsa); AVM */ if (beg_range) { sprintf(buf, "REST %"OFF_FMT"d", beg_range);