summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-12-31 18:57:37 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-12-31 18:57:37 +0000
commit98ee06d3d46aa7f89c204681c7075b53300a6a6e (patch)
tree0f5cafbb22cd83fb73e024acba658c7a51582951 /networking
parent806116b23407bdf95f22646f11f50b1d14e1cfc2 (diff)
downloadbusybox-w32-98ee06d3d46aa7f89c204681c7075b53300a6a6e.tar.gz
busybox-w32-98ee06d3d46aa7f89c204681c7075b53300a6a6e.tar.bz2
busybox-w32-98ee06d3d46aa7f89c204681c7075b53300a6a6e.zip
stop using __u32 etc. uint32_t is there for a reason
Diffstat (limited to 'networking')
-rw-r--r--networking/libiproute/ipaddress.c2
-rw-r--r--networking/libiproute/iplink.c28
-rw-r--r--networking/libiproute/iproute.c11
-rw-r--r--networking/libiproute/iprule.c14
-rw-r--r--networking/libiproute/iptunnel.c2
-rw-r--r--networking/libiproute/libnetlink.c4
-rw-r--r--networking/libiproute/libnetlink.h10
-rw-r--r--networking/libiproute/linux/pkt_sched.h169
-rw-r--r--networking/libiproute/rtm_map.c4
-rw-r--r--networking/libiproute/rtm_map.h2
-rw-r--r--networking/libiproute/utils.c20
-rw-r--r--networking/libiproute/utils.h26
-rw-r--r--networking/route.c18
13 files changed, 148 insertions, 162 deletions
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c
index e6130e4d7..bc9963f1f 100644
--- a/networking/libiproute/ipaddress.c
+++ b/networking/libiproute/ipaddress.c
@@ -616,7 +616,7 @@ int ipaddr_list_or_flush(int argc, char **argv, int flush)
616static int default_scope(inet_prefix *lcl) 616static int default_scope(inet_prefix *lcl)
617{ 617{
618 if (lcl->family == AF_INET) { 618 if (lcl->family == AF_INET) {
619 if (lcl->bytelen >= 1 && *(__u8*)&lcl->data == 127) 619 if (lcl->bytelen >= 1 && *(uint8_t*)&lcl->data == 127)
620 return RT_SCOPE_HOST; 620 return RT_SCOPE_HOST;
621 } 621 }
622 return 0; 622 return 0;
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
index ea57d60ac..ae41ab308 100644
--- a/networking/libiproute/iplink.c
+++ b/networking/libiproute/iplink.c
@@ -47,11 +47,11 @@ static int get_ctl_fd(void)
47 if (fd >= 0) 47 if (fd >= 0)
48 return fd; 48 return fd;
49 errno = s_errno; 49 errno = s_errno;
50 perror("Cannot create control socket"); 50 bb_perror_msg("cannot create control socket");
51 return -1; 51 return -1;
52} 52}
53 53
54static int do_chflags(char *dev, __u32 flags, __u32 mask) 54static int do_chflags(char *dev, uint32_t flags, uint32_t mask)
55{ 55{
56 struct ifreq ifr; 56 struct ifreq ifr;
57 int fd; 57 int fd;
@@ -63,7 +63,7 @@ static int do_chflags(char *dev, __u32 flags, __u32 mask)
63 return -1; 63 return -1;
64 err = ioctl(fd, SIOCGIFFLAGS, &ifr); 64 err = ioctl(fd, SIOCGIFFLAGS, &ifr);
65 if (err) { 65 if (err) {
66 perror("SIOCGIFFLAGS"); 66 bb_perror_msg("SIOCGIFFLAGS");
67 close(fd); 67 close(fd);
68 return -1; 68 return -1;
69 } 69 }
@@ -72,7 +72,7 @@ static int do_chflags(char *dev, __u32 flags, __u32 mask)
72 ifr.ifr_flags |= mask&flags; 72 ifr.ifr_flags |= mask&flags;
73 err = ioctl(fd, SIOCSIFFLAGS, &ifr); 73 err = ioctl(fd, SIOCSIFFLAGS, &ifr);
74 if (err) 74 if (err)
75 perror("SIOCSIFFLAGS"); 75 bb_perror_msg("SIOCSIFFLAGS");
76 } 76 }
77 close(fd); 77 close(fd);
78 return err; 78 return err;
@@ -91,7 +91,7 @@ static int do_changename(char *dev, char *newdev)
91 return -1; 91 return -1;
92 err = ioctl(fd, SIOCSIFNAME, &ifr); 92 err = ioctl(fd, SIOCSIFNAME, &ifr);
93 if (err) { 93 if (err) {
94 perror("SIOCSIFNAME"); 94 bb_perror_msg("SIOCSIFNAME");
95 close(fd); 95 close(fd);
96 return -1; 96 return -1;
97 } 97 }
@@ -112,7 +112,7 @@ static int set_qlen(char *dev, int qlen)
112 strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); 112 strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name));
113 ifr.ifr_qlen = qlen; 113 ifr.ifr_qlen = qlen;
114 if (ioctl(s, SIOCSIFTXQLEN, &ifr) < 0) { 114 if (ioctl(s, SIOCSIFTXQLEN, &ifr) < 0) {
115 perror("SIOCSIFXQLEN"); 115 bb_perror_msg("SIOCSIFXQLEN");
116 close(s); 116 close(s);
117 return -1; 117 return -1;
118 } 118 }
@@ -134,7 +134,7 @@ static int set_mtu(char *dev, int mtu)
134 strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); 134 strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name));
135 ifr.ifr_mtu = mtu; 135 ifr.ifr_mtu = mtu;
136 if (ioctl(s, SIOCSIFMTU, &ifr) < 0) { 136 if (ioctl(s, SIOCSIFMTU, &ifr) < 0) {
137 perror("SIOCSIFMTU"); 137 bb_perror_msg("SIOCSIFMTU");
138 close(s); 138 close(s);
139 return -1; 139 return -1;
140 } 140 }
@@ -152,14 +152,14 @@ static int get_address(char *dev, int *htype)
152 152
153 s = socket(PF_PACKET, SOCK_DGRAM, 0); 153 s = socket(PF_PACKET, SOCK_DGRAM, 0);
154 if (s < 0) { 154 if (s < 0) {
155 perror("socket(PF_PACKET)"); 155 bb_perror_msg("socket(PF_PACKET)");
156 return -1; 156 return -1;
157 } 157 }
158 158
159 memset(&ifr, 0, sizeof(ifr)); 159 memset(&ifr, 0, sizeof(ifr));
160 strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); 160 strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name));
161 if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) { 161 if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
162 perror("SIOCGIFINDEX"); 162 bb_perror_msg("SIOCGIFINDEX");
163 close(s); 163 close(s);
164 return -1; 164 return -1;
165 } 165 }
@@ -169,14 +169,14 @@ static int get_address(char *dev, int *htype)
169 me.sll_ifindex = ifr.ifr_ifindex; 169 me.sll_ifindex = ifr.ifr_ifindex;
170 me.sll_protocol = htons(ETH_P_LOOP); 170 me.sll_protocol = htons(ETH_P_LOOP);
171 if (bind(s, (struct sockaddr*)&me, sizeof(me)) == -1) { 171 if (bind(s, (struct sockaddr*)&me, sizeof(me)) == -1) {
172 perror("bind"); 172 bb_perror_msg("bind");
173 close(s); 173 close(s);
174 return -1; 174 return -1;
175 } 175 }
176 176
177 alen = sizeof(me); 177 alen = sizeof(me);
178 if (getsockname(s, (struct sockaddr*)&me, &alen) == -1) { 178 if (getsockname(s, (struct sockaddr*)&me, &alen) == -1) {
179 perror("getsockname"); 179 bb_perror_msg("getsockname");
180 close(s); 180 close(s);
181 return -1; 181 return -1;
182 } 182 }
@@ -210,7 +210,7 @@ static int set_address(struct ifreq *ifr, int brd)
210 if (s < 0) 210 if (s < 0)
211 return -1; 211 return -1;
212 if (ioctl(s, brd?SIOCSIFHWBROADCAST:SIOCSIFHWADDR, ifr) < 0) { 212 if (ioctl(s, brd?SIOCSIFHWBROADCAST:SIOCSIFHWADDR, ifr) < 0) {
213 perror(brd?"SIOCSIFHWBROADCAST":"SIOCSIFHWADDR"); 213 bb_perror_msg(brd ? "SIOCSIFHWBROADCAST" : "SIOCSIFHWADDR");
214 close(s); 214 close(s);
215 return -1; 215 return -1;
216 } 216 }
@@ -222,8 +222,8 @@ static int set_address(struct ifreq *ifr, int brd)
222static int do_set(int argc, char **argv) 222static int do_set(int argc, char **argv)
223{ 223{
224 char *dev = NULL; 224 char *dev = NULL;
225 __u32 mask = 0; 225 uint32_t mask = 0;
226 __u32 flags = 0; 226 uint32_t flags = 0;
227 int qlen = -1; 227 int qlen = -1;
228 int mtu = -1; 228 int mtu = -1;
229 char *newaddr = NULL; 229 char *newaddr = NULL;
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index 30d455602..bf6f95f61 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -15,12 +15,6 @@
15 15
16#include "libbb.h" 16#include "libbb.h"
17 17
18#include <sys/socket.h>
19
20#include <string.h>
21#include <fcntl.h>
22#include <unistd.h>
23
24#include "rt_names.h" 18#include "rt_names.h"
25#include "utils.h" 19#include "utils.h"
26#include "ip_common.h" 20#include "ip_common.h"
@@ -248,7 +242,7 @@ static int print_route(struct sockaddr_nl *who ATTRIBUTE_UNUSED,
248 abuf, sizeof(abuf))); 242 abuf, sizeof(abuf)));
249 } 243 }
250 if (tb[RTA_PRIORITY]) { 244 if (tb[RTA_PRIORITY]) {
251 fprintf(fp, " metric %d ", *(__u32*)RTA_DATA(tb[RTA_PRIORITY])); 245 fprintf(fp, " metric %d ", *(uint32_t*)RTA_DATA(tb[RTA_PRIORITY]));
252 } 246 }
253 if (r->rtm_family == AF_INET6) { 247 if (r->rtm_family == AF_INET6) {
254 struct rta_cacheinfo *ci = NULL; 248 struct rta_cacheinfo *ci = NULL;
@@ -405,7 +399,8 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
405 ll_init_map(&rth); 399 ll_init_map(&rth);
406 400
407 if (d) { 401 if (d) {
408 if ((idx = ll_name_to_index(d)) == 0) { 402 idx = ll_name_to_index(d);
403 if (idx == 0) {
409 bb_error_msg("cannot find device \"%s\"", d); 404 bb_error_msg("cannot find device \"%s\"", d);
410 return -1; 405 return -1;
411 } 406 }
diff --git a/networking/libiproute/iprule.c b/networking/libiproute/iprule.c
index 19338770f..2a1b3746c 100644
--- a/networking/libiproute/iprule.c
+++ b/networking/libiproute/iprule.c
@@ -119,7 +119,7 @@ static int print_rule(struct sockaddr_nl *who ATTRIBUTE_UNUSED,
119 fprintf(fp, "tos %s ", rtnl_dsfield_n2a(r->rtm_tos, b1, sizeof(b1))); 119 fprintf(fp, "tos %s ", rtnl_dsfield_n2a(r->rtm_tos, b1, sizeof(b1)));
120 } 120 }
121 if (tb[RTA_PROTOINFO]) { 121 if (tb[RTA_PROTOINFO]) {
122 fprintf(fp, "fwmark %#x ", *(__u32*)RTA_DATA(tb[RTA_PROTOINFO])); 122 fprintf(fp, "fwmark %#x ", *(uint32_t*)RTA_DATA(tb[RTA_PROTOINFO]));
123 } 123 }
124 124
125 if (tb[RTA_IIF]) { 125 if (tb[RTA_IIF]) {
@@ -130,8 +130,8 @@ static int print_rule(struct sockaddr_nl *who ATTRIBUTE_UNUSED,
130 fprintf(fp, "lookup %s ", rtnl_rttable_n2a(r->rtm_table, b1, sizeof(b1))); 130 fprintf(fp, "lookup %s ", rtnl_rttable_n2a(r->rtm_table, b1, sizeof(b1)));
131 131
132 if (tb[RTA_FLOW]) { 132 if (tb[RTA_FLOW]) {
133 __u32 to = *(__u32*)RTA_DATA(tb[RTA_FLOW]); 133 uint32_t to = *(uint32_t*)RTA_DATA(tb[RTA_FLOW]);
134 __u32 from = to>>16; 134 uint32_t from = to>>16;
135 to &= 0xFFFF; 135 to &= 0xFFFF;
136 if (from) { 136 if (from) {
137 fprintf(fp, "realms %s/", 137 fprintf(fp, "realms %s/",
@@ -230,25 +230,25 @@ int iprule_modify(int cmd, int argc, char **argv)
230 } else if (matches(*argv, "preference") == 0 || 230 } else if (matches(*argv, "preference") == 0 ||
231 matches(*argv, "order") == 0 || 231 matches(*argv, "order") == 0 ||
232 matches(*argv, "priority") == 0) { 232 matches(*argv, "priority") == 0) {
233 __u32 pref; 233 uint32_t pref;
234 NEXT_ARG(); 234 NEXT_ARG();
235 if (get_u32(&pref, *argv, 0)) 235 if (get_u32(&pref, *argv, 0))
236 invarg("preference value", *argv); 236 invarg("preference value", *argv);
237 addattr32(&req.n, sizeof(req), RTA_PRIORITY, pref); 237 addattr32(&req.n, sizeof(req), RTA_PRIORITY, pref);
238 } else if (strcmp(*argv, "tos") == 0) { 238 } else if (strcmp(*argv, "tos") == 0) {
239 __u32 tos; 239 uint32_t tos;
240 NEXT_ARG(); 240 NEXT_ARG();
241 if (rtnl_dsfield_a2n(&tos, *argv)) 241 if (rtnl_dsfield_a2n(&tos, *argv))
242 invarg("TOS value", *argv); 242 invarg("TOS value", *argv);
243 req.r.rtm_tos = tos; 243 req.r.rtm_tos = tos;
244 } else if (strcmp(*argv, "fwmark") == 0) { 244 } else if (strcmp(*argv, "fwmark") == 0) {
245 __u32 fwmark; 245 uint32_t fwmark;
246 NEXT_ARG(); 246 NEXT_ARG();
247 if (get_u32(&fwmark, *argv, 0)) 247 if (get_u32(&fwmark, *argv, 0))
248 invarg("fwmark value", *argv); 248 invarg("fwmark value", *argv);
249 addattr32(&req.n, sizeof(req), RTA_PROTOINFO, fwmark); 249 addattr32(&req.n, sizeof(req), RTA_PROTOINFO, fwmark);
250 } else if (matches(*argv, "realms") == 0) { 250 } else if (matches(*argv, "realms") == 0) {
251 __u32 realm; 251 uint32_t realm;
252 NEXT_ARG(); 252 NEXT_ARG();
253 if (get_rt_realms(&realm, *argv)) 253 if (get_rt_realms(&realm, *argv))
254 invarg("realms", *argv); 254 invarg("realms", *argv);
diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c
index 2080324ac..dbde477a0 100644
--- a/networking/libiproute/iptunnel.c
+++ b/networking/libiproute/iptunnel.c
@@ -267,7 +267,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
267 } 267 }
268 } else if (strcmp(*argv, "tos") == 0 || 268 } else if (strcmp(*argv, "tos") == 0 ||
269 matches(*argv, "dsfield") == 0) { 269 matches(*argv, "dsfield") == 0) {
270 __u32 uval; 270 uint32_t uval;
271 NEXT_ARG(); 271 NEXT_ARG();
272 if (strcmp(*argv, "inherit") != 0) { 272 if (strcmp(*argv, "inherit") != 0) {
273 if (rtnl_dsfield_a2n(&uval, *argv)) 273 if (rtnl_dsfield_a2n(&uval, *argv))
diff --git a/networking/libiproute/libnetlink.c b/networking/libiproute/libnetlink.c
index c7e17e1dd..969648067 100644
--- a/networking/libiproute/libnetlink.c
+++ b/networking/libiproute/libnetlink.c
@@ -319,7 +319,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
319 } 319 }
320} 320}
321 321
322int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data) 322int addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data)
323{ 323{
324 int len = RTA_LENGTH(4); 324 int len = RTA_LENGTH(4);
325 struct rtattr *rta; 325 struct rtattr *rta;
@@ -348,7 +348,7 @@ int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen)
348 return 0; 348 return 0;
349} 349}
350 350
351int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data) 351int rta_addattr32(struct rtattr *rta, int maxlen, int type, uint32_t data)
352{ 352{
353 int len = RTA_LENGTH(4); 353 int len = RTA_LENGTH(4);
354 struct rtattr *subrta; 354 struct rtattr *subrta;
diff --git a/networking/libiproute/libnetlink.h b/networking/libiproute/libnetlink.h
index 7cfcd2042..bd1913618 100644
--- a/networking/libiproute/libnetlink.h
+++ b/networking/libiproute/libnetlink.h
@@ -2,7 +2,7 @@
2#ifndef __LIBNETLINK_H__ 2#ifndef __LIBNETLINK_H__
3#define __LIBNETLINK_H__ 1 3#define __LIBNETLINK_H__ 1
4 4
5#include <asm/types.h> 5//#include <asm/types.h>
6#include <linux/netlink.h> 6#include <linux/netlink.h>
7#include <linux/rtnetlink.h> 7#include <linux/rtnetlink.h>
8 8
@@ -11,8 +11,8 @@ struct rtnl_handle
11 int fd; 11 int fd;
12 struct sockaddr_nl local; 12 struct sockaddr_nl local;
13 struct sockaddr_nl peer; 13 struct sockaddr_nl peer;
14 __u32 seq; 14 uint32_t seq;
15 __u32 dump; 15 uint32_t dump;
16}; 16};
17 17
18extern int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions); 18extern int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions);
@@ -31,9 +31,9 @@ extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
31extern int rtnl_send(struct rtnl_handle *rth, char *buf, int); 31extern int rtnl_send(struct rtnl_handle *rth, char *buf, int);
32 32
33 33
34extern int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data); 34extern int addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data);
35extern int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen); 35extern int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen);
36extern int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data); 36extern int rta_addattr32(struct rtattr *rta, int maxlen, int type, uint32_t data);
37extern int rta_addattr_l(struct rtattr *rta, int maxlen, int type, void *data, int alen); 37extern int rta_addattr_l(struct rtattr *rta, int maxlen, int type, void *data, int alen);
38 38
39extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len); 39extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len);
diff --git a/networking/libiproute/linux/pkt_sched.h b/networking/libiproute/linux/pkt_sched.h
index d6cf1fc06..36c0a46e3 100644
--- a/networking/libiproute/linux/pkt_sched.h
+++ b/networking/libiproute/linux/pkt_sched.h
@@ -15,7 +15,7 @@
15 filler or even bulk. 15 filler or even bulk.
16 */ 16 */
17 17
18#include <asm/types.h> 18//#include <asm/types.h>
19 19
20#define TC_PRIO_BESTEFFORT 0 20#define TC_PRIO_BESTEFFORT 0
21#define TC_PRIO_FILLER 1 21#define TC_PRIO_FILLER 1
@@ -32,15 +32,15 @@
32 32
33struct tc_stats 33struct tc_stats
34{ 34{
35 __u64 bytes; /* NUmber of enqueues bytes */ 35 uint64_t bytes; /* Nnmber of enqueued bytes */
36 __u32 packets; /* Number of enqueued packets */ 36 uint32_t packets; /* Number of enqueued packets */
37 __u32 drops; /* Packets dropped because of lack of resources */ 37 uint32_t drops; /* Packets dropped because of lack of resources */
38 __u32 overlimits; /* Number of throttle events when this 38 uint32_t overlimits; /* Number of throttle events when this
39 * flow goes out of allocated bandwidth */ 39 * flow goes out of allocated bandwidth */
40 __u32 bps; /* Current flow byte rate */ 40 uint32_t bps; /* Current flow byte rate */
41 __u32 pps; /* Current flow packet rate */ 41 uint32_t pps; /* Current flow packet rate */
42 __u32 qlen; 42 uint32_t qlen;
43 __u32 backlog; 43 uint32_t backlog;
44#ifdef __KERNEL__ 44#ifdef __KERNEL__
45 spinlock_t *lock; 45 spinlock_t *lock;
46#endif 46#endif
@@ -86,14 +86,14 @@ struct tc_ratespec
86 unsigned short feature; 86 unsigned short feature;
87 short addend; 87 short addend;
88 unsigned short mpu; 88 unsigned short mpu;
89 __u32 rate; 89 uint32_t rate;
90}; 90};
91 91
92/* FIFO section */ 92/* FIFO section */
93 93
94struct tc_fifo_qopt 94struct tc_fifo_qopt
95{ 95{
96 __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */ 96 uint32_t limit; /* Queue length: bytes for bfifo, packets for pfifo */
97}; 97};
98 98
99/* PRIO section */ 99/* PRIO section */
@@ -103,7 +103,7 @@ struct tc_fifo_qopt
103struct tc_prio_qopt 103struct tc_prio_qopt
104{ 104{
105 int bands; /* Number of bands */ 105 int bands; /* Number of bands */
106 __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ 106 uint8_t priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */
107}; 107};
108 108
109/* CSZ section */ 109/* CSZ section */
@@ -113,7 +113,7 @@ struct tc_csz_qopt
113 int flows; /* Maximal number of guaranteed flows */ 113 int flows; /* Maximal number of guaranteed flows */
114 unsigned char R_log; /* Fixed point position for round number */ 114 unsigned char R_log; /* Fixed point position for round number */
115 unsigned char delta_log; /* Log of maximal managed time interval */ 115 unsigned char delta_log; /* Log of maximal managed time interval */
116 __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> CSZ band */ 116 uint8_t priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> CSZ band */
117}; 117};
118 118
119struct tc_csz_copt 119struct tc_csz_copt
@@ -121,9 +121,9 @@ struct tc_csz_copt
121 struct tc_ratespec slice; 121 struct tc_ratespec slice;
122 struct tc_ratespec rate; 122 struct tc_ratespec rate;
123 struct tc_ratespec peakrate; 123 struct tc_ratespec peakrate;
124 __u32 limit; 124 uint32_t limit;
125 __u32 buffer; 125 uint32_t buffer;
126 __u32 mtu; 126 uint32_t mtu;
127}; 127};
128 128
129enum 129enum
@@ -140,9 +140,9 @@ struct tc_tbf_qopt
140{ 140{
141 struct tc_ratespec rate; 141 struct tc_ratespec rate;
142 struct tc_ratespec peakrate; 142 struct tc_ratespec peakrate;
143 __u32 limit; 143 uint32_t limit;
144 __u32 buffer; 144 uint32_t buffer;
145 __u32 mtu; 145 uint32_t mtu;
146}; 146};
147 147
148enum 148enum
@@ -164,7 +164,7 @@ struct tc_sfq_qopt
164{ 164{
165 unsigned quantum; /* Bytes per round allocated to flow */ 165 unsigned quantum; /* Bytes per round allocated to flow */
166 int perturb_period; /* Period of hash perturbation */ 166 int perturb_period; /* Period of hash perturbation */
167 __u32 limit; /* Maximal packets in queue */ 167 uint32_t limit; /* Maximal packets in queue */
168 unsigned divisor; /* Hash divisor */ 168 unsigned divisor; /* Hash divisor */
169 unsigned flows; /* Maximal number of flows */ 169 unsigned flows; /* Maximal number of flows */
170}; 170};
@@ -189,9 +189,9 @@ enum
189 189
190struct tc_red_qopt 190struct tc_red_qopt
191{ 191{
192 __u32 limit; /* HARD maximal queue length (bytes) */ 192 uint32_t limit; /* HARD maximal queue length (bytes) */
193 __u32 qth_min; /* Min average length threshold (bytes) */ 193 uint32_t qth_min; /* Min average length threshold (bytes) */
194 __u32 qth_max; /* Max average length threshold (bytes) */ 194 uint32_t qth_max; /* Max average length threshold (bytes) */
195 unsigned char Wlog; /* log(W) */ 195 unsigned char Wlog; /* log(W) */
196 unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ 196 unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
197 unsigned char Scell_log; /* cell size for idle damping */ 197 unsigned char Scell_log; /* cell size for idle damping */
@@ -201,10 +201,10 @@ struct tc_red_qopt
201 201
202struct tc_red_xstats 202struct tc_red_xstats
203{ 203{
204 __u32 early; /* Early drops */ 204 uint32_t early; /* Early drops */
205 __u32 pdrop; /* Drops due to queue limits */ 205 uint32_t pdrop; /* Drops due to queue limits */
206 __u32 other; /* Drops due to drop() calls */ 206 uint32_t other; /* Drops due to drop() calls */
207 __u32 marked; /* Marked packets */ 207 uint32_t marked; /* Marked packets */
208}; 208};
209 209
210/* GRED section */ 210/* GRED section */
@@ -222,33 +222,30 @@ enum
222#define TCA_SET_OFF TCA_GRED_PARMS 222#define TCA_SET_OFF TCA_GRED_PARMS
223struct tc_gred_qopt 223struct tc_gred_qopt
224{ 224{
225 __u32 limit; /* HARD maximal queue length (bytes) 225 uint32_t limit; /* HARD maximal queue length (bytes) */
226*/ 226 uint32_t qth_min; /* Min average length threshold (bytes) */
227 __u32 qth_min; /* Min average length threshold (bytes) 227 uint32_t qth_max; /* Max average length threshold (bytes) */
228*/ 228 uint32_t DP; /* upto 2^32 DPs */
229 __u32 qth_max; /* Max average length threshold (bytes) 229 uint32_t backlog;
230*/ 230 uint32_t qave;
231 __u32 DP; /* upto 2^32 DPs */ 231 uint32_t forced;
232 __u32 backlog; 232 uint32_t early;
233 __u32 qave; 233 uint32_t other;
234 __u32 forced; 234 uint32_t pdrop;
235 __u32 early; 235
236 __u32 other; 236 unsigned char Wlog; /* log(W) */
237 __u32 pdrop;
238
239 unsigned char Wlog; /* log(W) */
240 unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ 237 unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
241 unsigned char Scell_log; /* cell size for idle damping */ 238 unsigned char Scell_log; /* cell size for idle damping */
242 __u8 prio; /* prio of this VQ */ 239 uint8_t prio; /* prio of this VQ */
243 __u32 packets; 240 uint32_t packets;
244 __u32 bytesin; 241 uint32_t bytesin;
245}; 242};
246/* gred setup */ 243/* gred setup */
247struct tc_gred_sopt 244struct tc_gred_sopt
248{ 245{
249 __u32 DPs; 246 uint32_t DPs;
250 __u32 def_DP; 247 uint32_t def_DP;
251 __u8 grio; 248 uint8_t grio;
252}; 249};
253 250
254/* HTB section */ 251/* HTB section */
@@ -257,30 +254,30 @@ struct tc_gred_sopt
257 254
258struct tc_htb_opt 255struct tc_htb_opt
259{ 256{
260 struct tc_ratespec rate; 257 struct tc_ratespec rate;
261 struct tc_ratespec ceil; 258 struct tc_ratespec ceil;
262 __u32 buffer; 259 uint32_t buffer;
263 __u32 cbuffer; 260 uint32_t cbuffer;
264 __u32 quantum; /* out only */ 261 uint32_t quantum; /* out only */
265 __u32 level; /* out only */ 262 uint32_t level; /* out only */
266 __u8 prio; 263 uint8_t prio;
267 __u8 injectd; /* inject class distance */ 264 uint8_t injectd; /* inject class distance */
268 __u8 pad[2]; 265 uint8_t pad[2];
269}; 266};
270struct tc_htb_glob 267struct tc_htb_glob
271{ 268{
272 __u32 rate2quantum; /* bps->quantum divisor */ 269 uint32_t rate2quantum; /* bps->quantum divisor */
273 __u32 defcls; /* default class number */ 270 uint32_t defcls; /* default class number */
274 __u32 use_dcache; /* use dequeue cache ? */ 271 uint32_t use_dcache; /* use dequeue cache ? */
275 __u32 debug; /* debug flags */ 272 uint32_t debug; /* debug flags */
276 273
277 274
278 /* stats */ 275 /* stats */
279 __u32 deq_rate; /* dequeue rate */ 276 uint32_t deq_rate; /* dequeue rate */
280 __u32 utilz; /* dequeue utilization */ 277 uint32_t utilz; /* dequeue utilization */
281 __u32 trials; /* deq_prio trials per dequeue */ 278 uint32_t trials; /* deq_prio trials per dequeue */
282 __u32 dcache_hits; 279 uint32_t dcache_hits;
283 __u32 direct_pkts; /* count of non shapped packets */ 280 uint32_t direct_pkts; /* count of non shapped packets */
284}; 281};
285enum 282enum
286{ 283{
@@ -292,12 +289,12 @@ enum
292}; 289};
293struct tc_htb_xstats 290struct tc_htb_xstats
294{ 291{
295 __u32 lends; 292 uint32_t lends;
296 __u32 borrows; 293 uint32_t borrows;
297 __u32 giants; /* too big packets (rate will not be accurate) */ 294 uint32_t giants; /* too big packets (rate will not be accurate) */
298 __u32 injects; /* how many times leaf used injected bw */ 295 uint32_t injects; /* how many times leaf used injected bw */
299 __u32 tokens; 296 uint32_t tokens;
300 __u32 ctokens; 297 uint32_t ctokens;
301}; 298};
302 299
303/* CBQ section */ 300/* CBQ section */
@@ -320,10 +317,10 @@ struct tc_cbq_lssopt
320#define TCF_CBQ_LSS_MINIDLE 8 317#define TCF_CBQ_LSS_MINIDLE 8
321#define TCF_CBQ_LSS_OFFTIME 0x10 318#define TCF_CBQ_LSS_OFFTIME 0x10
322#define TCF_CBQ_LSS_AVPKT 0x20 319#define TCF_CBQ_LSS_AVPKT 0x20
323 __u32 maxidle; 320 uint32_t maxidle;
324 __u32 minidle; 321 uint32_t minidle;
325 __u32 offtime; 322 uint32_t offtime;
326 __u32 avpkt; 323 uint32_t avpkt;
327}; 324};
328 325
329struct tc_cbq_wrropt 326struct tc_cbq_wrropt
@@ -332,8 +329,8 @@ struct tc_cbq_wrropt
332 unsigned char priority; 329 unsigned char priority;
333 unsigned char cpriority; 330 unsigned char cpriority;
334 unsigned char __reserved; 331 unsigned char __reserved;
335 __u32 allot; 332 uint32_t allot;
336 __u32 weight; 333 uint32_t weight;
337}; 334};
338 335
339struct tc_cbq_ovl 336struct tc_cbq_ovl
@@ -345,7 +342,7 @@ struct tc_cbq_ovl
345#define TC_CBQ_OVL_DROP 3 342#define TC_CBQ_OVL_DROP 3
346#define TC_CBQ_OVL_RCLASSIC 4 343#define TC_CBQ_OVL_RCLASSIC 4
347 unsigned char priority2; 344 unsigned char priority2;
348 __u32 penalty; 345 uint32_t penalty;
349}; 346};
350 347
351struct tc_cbq_police 348struct tc_cbq_police
@@ -357,17 +354,17 @@ struct tc_cbq_police
357 354
358struct tc_cbq_fopt 355struct tc_cbq_fopt
359{ 356{
360 __u32 split; 357 uint32_t split;
361 __u32 defmap; 358 uint32_t defmap;
362 __u32 defchange; 359 uint32_t defchange;
363}; 360};
364 361
365struct tc_cbq_xstats 362struct tc_cbq_xstats
366{ 363{
367 __u32 borrows; 364 uint32_t borrows;
368 __u32 overactions; 365 uint32_t overactions;
369 __s32 avgidle; 366 int32_t avgidle;
370 __s32 undertime; 367 int32_t undertime;
371}; 368};
372 369
373enum 370enum
diff --git a/networking/libiproute/rtm_map.c b/networking/libiproute/rtm_map.c
index 8aaee4bd7..7eb4c7122 100644
--- a/networking/libiproute/rtm_map.c
+++ b/networking/libiproute/rtm_map.c
@@ -88,9 +88,9 @@ int rtnl_rtntype_a2n(int *id, char *arg)
88 return 0; 88 return 0;
89} 89}
90 90
91int get_rt_realms(__u32 *realms, char *arg) 91int get_rt_realms(uint32_t *realms, char *arg)
92{ 92{
93 __u32 realm = 0; 93 uint32_t realm = 0;
94 char *p = strchr(arg, '/'); 94 char *p = strchr(arg, '/');
95 95
96 *realms = 0; 96 *realms = 0;
diff --git a/networking/libiproute/rtm_map.h b/networking/libiproute/rtm_map.h
index 1ffb940b9..b9c8c503f 100644
--- a/networking/libiproute/rtm_map.h
+++ b/networking/libiproute/rtm_map.h
@@ -5,7 +5,7 @@
5char *rtnl_rtntype_n2a(int id, char *buf, int len); 5char *rtnl_rtntype_n2a(int id, char *buf, int len);
6int rtnl_rtntype_a2n(int *id, char *arg); 6int rtnl_rtntype_a2n(int *id, char *arg);
7 7
8int get_rt_realms(__u32 *realms, char *arg); 8int get_rt_realms(uint32_t *realms, char *arg);
9 9
10 10
11#endif /* __RTM_MAP_H__ */ 11#endif /* __RTM_MAP_H__ */
diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c
index fc6aff1d1..aa60ffd01 100644
--- a/networking/libiproute/utils.c
+++ b/networking/libiproute/utils.c
@@ -47,7 +47,7 @@ int get_unsigned(unsigned *val, char *arg, int base)
47 return 0; 47 return 0;
48} 48}
49 49
50int get_u32(__u32 * val, char *arg, int base) 50int get_u32(uint32_t * val, char *arg, int base)
51{ 51{
52 unsigned long res; 52 unsigned long res;
53 char *ptr; 53 char *ptr;
@@ -61,7 +61,7 @@ int get_u32(__u32 * val, char *arg, int base)
61 return 0; 61 return 0;
62} 62}
63 63
64int get_u16(__u16 * val, char *arg, int base) 64int get_u16(uint16_t * val, char *arg, int base)
65{ 65{
66 unsigned long res; 66 unsigned long res;
67 char *ptr; 67 char *ptr;
@@ -75,7 +75,7 @@ int get_u16(__u16 * val, char *arg, int base)
75 return 0; 75 return 0;
76} 76}
77 77
78int get_u8(__u8 * val, char *arg, int base) 78int get_u8(uint8_t * val, char *arg, int base)
79{ 79{
80 unsigned long res; 80 unsigned long res;
81 char *ptr; 81 char *ptr;
@@ -89,7 +89,7 @@ int get_u8(__u8 * val, char *arg, int base)
89 return 0; 89 return 0;
90} 90}
91 91
92int get_s16(__s16 * val, char *arg, int base) 92int get_s16(int16_t * val, char *arg, int base)
93{ 93{
94 long res; 94 long res;
95 char *ptr; 95 char *ptr;
@@ -103,7 +103,7 @@ int get_s16(__s16 * val, char *arg, int base)
103 return 0; 103 return 0;
104} 104}
105 105
106int get_s8(__s8 * val, char *arg, int base) 106int get_s8(int8_t * val, char *arg, int base)
107{ 107{
108 long res; 108 long res;
109 char *ptr; 109 char *ptr;
@@ -225,7 +225,7 @@ int get_prefix(inet_prefix * dst, char *arg, int family)
225 return 0; 225 return 0;
226} 226}
227 227
228__u32 get_addr32(char *name) 228uint32_t get_addr32(char *name)
229{ 229{
230 inet_prefix addr; 230 inet_prefix addr;
231 231
@@ -268,8 +268,8 @@ int matches(char *cmd, char *pattern)
268 268
269int inet_addr_match(inet_prefix * a, inet_prefix * b, int bits) 269int inet_addr_match(inet_prefix * a, inet_prefix * b, int bits)
270{ 270{
271 __u32 *a1 = a->data; 271 uint32_t *a1 = a->data;
272 __u32 *a2 = b->data; 272 uint32_t *a2 = b->data;
273 int words = bits >> 0x05; 273 int words = bits >> 0x05;
274 274
275 bits &= 0x1f; 275 bits &= 0x1f;
@@ -279,8 +279,8 @@ int inet_addr_match(inet_prefix * a, inet_prefix * b, int bits)
279 return -1; 279 return -1;
280 280
281 if (bits) { 281 if (bits) {
282 __u32 w1, w2; 282 uint32_t w1, w2;
283 __u32 mask; 283 uint32_t mask;
284 284
285 w1 = a1[words]; 285 w1 = a1[words];
286 w2 = a2[words]; 286 w2 = a2[words];
diff --git a/networking/libiproute/utils.h b/networking/libiproute/utils.h
index 98634dde7..3ecbb3abd 100644
--- a/networking/libiproute/utils.h
+++ b/networking/libiproute/utils.h
@@ -3,8 +3,8 @@
3#define __UTILS_H__ 1 3#define __UTILS_H__ 1
4 4
5#include "libbb.h" 5#include "libbb.h"
6#include <asm/types.h> 6//#include <asm/types.h>
7#include <resolv.h> 7//#include <resolv.h>
8 8
9#include "libnetlink.h" 9#include "libnetlink.h"
10#include "ll_map.h" 10#include "ll_map.h"
@@ -34,10 +34,10 @@ extern void incomplete_command(void) ATTRIBUTE_NORETURN;
34 34
35typedef struct 35typedef struct
36{ 36{
37 __u8 family; 37 uint8_t family;
38 __u8 bytelen; 38 uint8_t bytelen;
39 __s16 bitlen; 39 int16_t bitlen;
40 __u32 data[4]; 40 uint32_t data[4];
41} inet_prefix; 41} inet_prefix;
42 42
43#define DN_MAXADDL 20 43#define DN_MAXADDL 20
@@ -58,7 +58,7 @@ struct ipx_addr {
58 uint8_t ipx_node[IPX_NODE_LEN]; 58 uint8_t ipx_node[IPX_NODE_LEN];
59}; 59};
60 60
61extern __u32 get_addr32(char *name); 61extern uint32_t get_addr32(char *name);
62extern int get_addr_1(inet_prefix *dst, char *arg, int family); 62extern int get_addr_1(inet_prefix *dst, char *arg, int family);
63extern int get_prefix_1(inet_prefix *dst, char *arg, int family); 63extern int get_prefix_1(inet_prefix *dst, char *arg, int family);
64extern int get_addr(inet_prefix *dst, char *arg, int family); 64extern int get_addr(inet_prefix *dst, char *arg, int family);
@@ -69,11 +69,11 @@ extern int get_unsigned(unsigned *val, char *arg, int base);
69#define get_byte get_u8 69#define get_byte get_u8
70#define get_ushort get_u16 70#define get_ushort get_u16
71#define get_short get_s16 71#define get_short get_s16
72extern int get_u32(__u32 *val, char *arg, int base); 72extern int get_u32(uint32_t *val, char *arg, int base);
73extern int get_u16(__u16 *val, char *arg, int base); 73extern int get_u16(uint16_t *val, char *arg, int base);
74extern int get_s16(__s16 *val, char *arg, int base); 74extern int get_s16(int16_t *val, char *arg, int base);
75extern int get_u8(__u8 *val, char *arg, int base); 75extern int get_u8(uint8_t *val, char *arg, int base);
76extern int get_s8(__s8 *val, char *arg, int base); 76extern int get_s8(int8_t *val, char *arg, int base);
77 77
78extern const char *format_host(int af, int len, void *addr, char *buf, int buflen); 78extern const char *format_host(int af, int len, void *addr, char *buf, int buflen);
79extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int buflen); 79extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int buflen);
@@ -93,7 +93,7 @@ int ipx_pton(int af, const char *src, void *addr);
93extern int __iproute2_hz_internal; 93extern int __iproute2_hz_internal;
94extern int __get_hz(void); 94extern int __get_hz(void);
95 95
96static __inline__ int get_hz(void) 96static inline int get_hz(void)
97{ 97{
98 if (__iproute2_hz_internal == 0) 98 if (__iproute2_hz_internal == 0)
99 __iproute2_hz_internal = __get_hz(); 99 __iproute2_hz_internal = __get_hz();
diff --git a/networking/route.c b/networking/route.c
index a8926f44e..d6d9b7dd9 100644
--- a/networking/route.c
+++ b/networking/route.c
@@ -462,17 +462,13 @@ static const char flagchars[] = /* Must agree with flagvals[]. */
462#endif 462#endif
463; 463;
464 464
465static 465static void set_flags(char *flagstr, int flags)
466#ifndef CONFIG_FEATURE_IPV6
467__inline
468#endif
469void set_flags(char *flagstr, int flags)
470{ 466{
471 int i; 467 int i;
472 468
473 *flagstr++ = 'U'; 469 *flagstr++ = 'U';
474 470
475 for (i=0 ; (*flagstr = flagchars[i]) != 0 ; i++) { 471 for (i = 0; (*flagstr = flagchars[i]) != 0; i++) {
476 if (flags & flagvals[i]) { 472 if (flags & flagvals[i]) {
477 ++flagstr; 473 ++flagstr;
478 } 474 }
@@ -480,7 +476,6 @@ void set_flags(char *flagstr, int flags)
480} 476}
481 477
482/* also used in netstat */ 478/* also used in netstat */
483void displayroutes(int noresolve, int netstatfmt);
484void displayroutes(int noresolve, int netstatfmt) 479void displayroutes(int noresolve, int netstatfmt)
485{ 480{
486 char devname[64], flags[16], sdest[16], sgw[16]; 481 char devname[64], flags[16], sdest[16], sgw[16];
@@ -492,9 +487,8 @@ void displayroutes(int noresolve, int netstatfmt)
492 FILE *fp = xfopen("/proc/net/route", "r"); 487 FILE *fp = xfopen("/proc/net/route", "r");
493 488
494 printf("Kernel IP routing table\n" 489 printf("Kernel IP routing table\n"
495 "Destination Gateway Genmask" 490 "Destination Gateway Genmask Flags %s Iface\n",
496 " Flags %s Iface\n", 491 netstatfmt ? " MSS Window irtt" : "Metric Ref Use");
497 netstatfmt ? " MSS Window irtt" : "Metric Ref Use");
498 492
499 if (fscanf(fp, "%*[^\n]\n") < 0) { /* Skip the first line. */ 493 if (fscanf(fp, "%*[^\n]\n") < 0) { /* Skip the first line. */
500 goto ERROR; /* Empty or missing line, or read error. */ 494 goto ERROR; /* Empty or missing line, or read error. */
@@ -508,7 +502,7 @@ void displayroutes(int noresolve, int netstatfmt)
508 if ((r < 0) && feof(fp)) { /* EOF with no (nonspace) chars read. */ 502 if ((r < 0) && feof(fp)) { /* EOF with no (nonspace) chars read. */
509 break; 503 break;
510 } 504 }
511 ERROR: 505 ERROR:
512 bb_error_msg_and_die("fscanf"); 506 bb_error_msg_and_die("fscanf");
513 } 507 }
514 508
@@ -574,7 +568,7 @@ static void INET6_displayroutes(int noresolve)
574 if ((r < 0) && feof(fp)) { /* EOF with no (nonspace) chars read. */ 568 if ((r < 0) && feof(fp)) { /* EOF with no (nonspace) chars read. */
575 break; 569 break;
576 } 570 }
577 ERROR: 571 ERROR:
578 bb_error_msg_and_die("fscanf"); 572 bb_error_msg_and_die("fscanf");
579 } 573 }
580 574