Accepting request 65041 from security:netfilter
Accepted submit request 65041 from user licensedigger OBS-URL: https://build.opensuse.org/request/show/65041 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/iproute2?expand=0&rev=41
This commit is contained in:
commit
ef6233a938
@ -1,30 +0,0 @@
|
|||||||
--- ip/ipaddress.c 2009-03-24 22:40:54.000000000 +0000
|
|
||||||
+++ ip/ipaddress.c 2009-11-11 09:30:07.000000000 +0000
|
|
||||||
@@ -692,6 +692,12 @@
|
|
||||||
if (flush) {
|
|
||||||
int round = 0;
|
|
||||||
char flushb[4096-512];
|
|
||||||
+ uid_t uid = geteuid();
|
|
||||||
+
|
|
||||||
+ if(uid) {
|
|
||||||
+ fprintf(stderr, "Not sufficient rights to flush\n");
|
|
||||||
+ exit(EXIT_FAILURE);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
filter.flushb = flushb;
|
|
||||||
filter.flushp = 0;
|
|
||||||
--- ip/iproute.c 2009-11-11 09:30:07.000000000 +0000
|
|
||||||
+++ ip/iproute.c 2009-11-11 09:35:23.000000000 +0000
|
|
||||||
@@ -1212,6 +1212,12 @@
|
|
||||||
int round = 0;
|
|
||||||
char flushb[4096-512];
|
|
||||||
time_t start = time(0);
|
|
||||||
+ uid_t uid = geteuid();
|
|
||||||
+
|
|
||||||
+ if(uid) {
|
|
||||||
+ fprintf(stderr, "Not sufficient rights to flush\n");
|
|
||||||
+ exit(EXIT_FAILURE);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (filter.cloned) {
|
|
||||||
if (do_ipv6 != AF_INET6) {
|
|
@ -1,18 +0,0 @@
|
|||||||
--- ip/iptunnel.c 2009-07-28 13:28:59.000000000 +0200
|
|
||||||
+++ ip/iptunnel.c 2009-07-28 13:29:29.000000000 +0200
|
|
||||||
@@ -400,6 +400,7 @@
|
|
||||||
if ((ptr = strchr(buf, ':')) == NULL ||
|
|
||||||
(*ptr++ = 0, sscanf(buf, "%s", name) != 1)) {
|
|
||||||
fprintf(stderr, "Wrong format of /proc/net/dev. Sorry.\n");
|
|
||||||
+ fclose (fp);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (sscanf(ptr, "%ld%ld%ld%ld%ld%ld%ld%*d%ld%ld%ld%ld%ld%ld%ld",
|
|
||||||
@@ -438,6 +439,7 @@
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
+ fclose (fp);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
tc/m_skbedit.c | 2 ++
|
|
||||||
1 file changed, 2 insertions(+)
|
|
||||||
|
|
||||||
Index: tc/m_skbedit.c
|
|
||||||
===================================================================
|
|
||||||
--- tc/m_skbedit.c.orig
|
|
||||||
+++ tc/m_skbedit.c
|
|
||||||
@@ -60,6 +60,8 @@ parse_skbedit(struct action_util *a, int
|
|
||||||
__u32 flags = 0, priority, mark;
|
|
||||||
struct tc_skbedit sel = { 0 };
|
|
||||||
|
|
||||||
+ memset(&sel, 0, sizeof(struct tc_skbedit));
|
|
||||||
+
|
|
||||||
if (matches(*argv, "skbedit") != 0)
|
|
||||||
return -1;
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
|||||||
--- misc/ss.c 2009-10-09 14:26:41.000000000 +0200
|
|
||||||
+++ misc/ss.c 2009-10-09 14:30:00.000000000 +0200
|
|
||||||
@@ -464,6 +464,7 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+ pclose (fp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
--- misc/ss.c 2009-10-09 14:39:14.000000000 +0200
|
|
||||||
+++ misc/ss.c 2009-10-09 14:40:25.000000000 +0200
|
|
||||||
@@ -1571,10 +1571,12 @@
|
|
||||||
status = fread(buf, 1, sizeof(*h), fp);
|
|
||||||
if (status < 0) {
|
|
||||||
perror("Reading header from $TCPDIAG_FILE");
|
|
||||||
+ fclose (fp);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (status != sizeof(*h)) {
|
|
||||||
perror("Unexpected EOF reading $TCPDIAG_FILE");
|
|
||||||
+ fclose (fp);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1582,16 +1584,20 @@
|
|
||||||
|
|
||||||
if (status < 0) {
|
|
||||||
perror("Reading $TCPDIAG_FILE");
|
|
||||||
+ fclose (fp);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (status + sizeof(*h) < h->nlmsg_len) {
|
|
||||||
perror("Unexpected EOF reading $TCPDIAG_FILE");
|
|
||||||
+ fclose (fp);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The only legal exit point */
|
|
||||||
- if (h->nlmsg_type == NLMSG_DONE)
|
|
||||||
+ if (h->nlmsg_type == NLMSG_DONE) {
|
|
||||||
+ fclose (fp);
|
|
||||||
return 0;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (h->nlmsg_type == NLMSG_ERROR) {
|
|
||||||
struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h);
|
|
||||||
@@ -1601,13 +1607,17 @@
|
|
||||||
errno = -err->error;
|
|
||||||
perror("TCPDIAG answered");
|
|
||||||
}
|
|
||||||
+ fclose (fp);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = tcp_show_sock(h, f);
|
|
||||||
- if (err < 0)
|
|
||||||
+ if (err < 0) {
|
|
||||||
+ fclose (fp);
|
|
||||||
return err;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
+ fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int tcp_show(struct filter *f, int socktype)
|
|
@ -1,355 +0,0 @@
|
|||||||
---
|
|
||||||
ip/ip6tunnel.c | 5 +++--
|
|
||||||
ip/ipmaddr.c | 3 ++-
|
|
||||||
ip/ipmroute.c | 6 ++++--
|
|
||||||
ip/iptunnel.c | 5 +++--
|
|
||||||
ip/rtmon.c | 6 ++++--
|
|
||||||
misc/ifstat.c | 6 ++++--
|
|
||||||
misc/lnstat_util.c | 11 +++++++----
|
|
||||||
misc/nstat.c | 6 ++++--
|
|
||||||
misc/rtacct.c | 6 ++++--
|
|
||||||
misc/ss.c | 39 ++++++++++++++++++++++++++-------------
|
|
||||||
netem/maketable.c | 3 ++-
|
|
||||||
11 files changed, 63 insertions(+), 33 deletions(-)
|
|
||||||
|
|
||||||
Index: ip/ip6tunnel.c
|
|
||||||
===================================================================
|
|
||||||
--- ip/ip6tunnel.c.orig
|
|
||||||
+++ ip/ip6tunnel.c
|
|
||||||
@@ -262,8 +262,9 @@ static int do_tunnels_list(struct ip6_tn
|
|
||||||
}
|
|
||||||
|
|
||||||
/* skip two lines at the begenning of the file */
|
|
||||||
- fgets(buf, sizeof(buf), fp);
|
|
||||||
- fgets(buf, sizeof(buf), fp);
|
|
||||||
+ char* res = 0;
|
|
||||||
+ res = fgets(buf, sizeof(buf), fp);
|
|
||||||
+ res = fgets(buf, sizeof(buf), fp);
|
|
||||||
|
|
||||||
while (fgets(buf, sizeof(buf), fp) != NULL) {
|
|
||||||
char name[IFNAMSIZ];
|
|
||||||
Index: ip/ipmaddr.c
|
|
||||||
===================================================================
|
|
||||||
--- ip/ipmaddr.c.orig
|
|
||||||
+++ ip/ipmaddr.c
|
|
||||||
@@ -128,7 +128,8 @@ void read_igmp(struct ma_info **result_p
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
memset(&m, 0, sizeof(m));
|
|
||||||
- fgets(buf, sizeof(buf), fp);
|
|
||||||
+ char* res = 0;
|
|
||||||
+ res = fgets(buf, sizeof(buf), fp);
|
|
||||||
|
|
||||||
m.addr.family = AF_INET;
|
|
||||||
m.addr.bitlen = 32;
|
|
||||||
Index: ip/ipmroute.c
|
|
||||||
===================================================================
|
|
||||||
--- ip/ipmroute.c.orig
|
|
||||||
+++ ip/ipmroute.c
|
|
||||||
@@ -58,7 +58,8 @@ static void read_viftable(void)
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
- fgets(buf, sizeof(buf), fp);
|
|
||||||
+ char* res = 0;
|
|
||||||
+ res = fgets(buf, sizeof(buf), fp);
|
|
||||||
|
|
||||||
while (fgets(buf, sizeof(buf), fp)) {
|
|
||||||
int vifi;
|
|
||||||
@@ -83,7 +84,8 @@ static void read_mroute_list(FILE *ofp)
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
- fgets(buf, sizeof(buf), fp);
|
|
||||||
+ char* res = 0;
|
|
||||||
+ res = fgets(buf, sizeof(buf), fp);
|
|
||||||
|
|
||||||
while (fgets(buf, sizeof(buf), fp)) {
|
|
||||||
inet_prefix maddr, msrc;
|
|
||||||
Index: ip/iptunnel.c
|
|
||||||
===================================================================
|
|
||||||
--- ip/iptunnel.c.orig
|
|
||||||
+++ ip/iptunnel.c
|
|
||||||
@@ -407,8 +407,9 @@ static int do_tunnels_list(struct ip_tun
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
- fgets(buf, sizeof(buf), fp);
|
|
||||||
- fgets(buf, sizeof(buf), fp);
|
|
||||||
+ char* res = 0;
|
|
||||||
+ res = fgets(buf, sizeof(buf), fp);
|
|
||||||
+ res = fgets(buf, sizeof(buf), fp);
|
|
||||||
|
|
||||||
while (fgets(buf, sizeof(buf), fp) != NULL) {
|
|
||||||
int index, type;
|
|
||||||
Index: ip/rtmon.c
|
|
||||||
===================================================================
|
|
||||||
--- ip/rtmon.c.orig
|
|
||||||
+++ ip/rtmon.c
|
|
||||||
@@ -33,6 +33,7 @@ static void write_stamp(FILE *fp)
|
|
||||||
char buf[128];
|
|
||||||
struct nlmsghdr *n1 = (void*)buf;
|
|
||||||
struct timeval tv;
|
|
||||||
+ size_t res;
|
|
||||||
|
|
||||||
n1->nlmsg_type = 15;
|
|
||||||
n1->nlmsg_flags = 0;
|
|
||||||
@@ -42,7 +43,7 @@ static void write_stamp(FILE *fp)
|
|
||||||
gettimeofday(&tv, NULL);
|
|
||||||
((__u32*)NLMSG_DATA(n1))[0] = tv.tv_sec;
|
|
||||||
((__u32*)NLMSG_DATA(n1))[1] = tv.tv_usec;
|
|
||||||
- fwrite((void*)n1, 1, NLMSG_ALIGN(n1->nlmsg_len), fp);
|
|
||||||
+ res = fwrite((void*)n1, 1, NLMSG_ALIGN(n1->nlmsg_len), fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int dump_msg(const struct sockaddr_nl *who, struct nlmsghdr *n,
|
|
||||||
@@ -51,7 +52,8 @@ static int dump_msg(const struct sockadd
|
|
||||||
FILE *fp = (FILE*)arg;
|
|
||||||
if (!init_phase)
|
|
||||||
write_stamp(fp);
|
|
||||||
- fwrite((void*)n, 1, NLMSG_ALIGN(n->nlmsg_len), fp);
|
|
||||||
+ int res = 0;
|
|
||||||
+ res = fwrite((void*)n, 1, NLMSG_ALIGN(n->nlmsg_len), fp);
|
|
||||||
fflush(fp);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Index: misc/ifstat.c
|
|
||||||
===================================================================
|
|
||||||
--- misc/ifstat.c.orig
|
|
||||||
+++ misc/ifstat.c
|
|
||||||
@@ -716,8 +716,9 @@ int main(int argc, char *argv[])
|
|
||||||
fclose(tfp);
|
|
||||||
}
|
|
||||||
if (uptime >= 0 && time(NULL) >= stb.st_mtime+uptime) {
|
|
||||||
+ int res = 0;
|
|
||||||
fprintf(stderr, "ifstat: history is aged out, resetting\n");
|
|
||||||
- ftruncate(fileno(hist_fp), 0);
|
|
||||||
+ res = ftruncate(fileno(hist_fp), 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -759,7 +760,8 @@ int main(int argc, char *argv[])
|
|
||||||
dump_incr_db(stdout);
|
|
||||||
}
|
|
||||||
if (!no_update) {
|
|
||||||
- ftruncate(fileno(hist_fp), 0);
|
|
||||||
+ int res = 0;
|
|
||||||
+ res = ftruncate(fileno(hist_fp), 0);
|
|
||||||
rewind(hist_fp);
|
|
||||||
dump_raw_db(hist_fp, 1);
|
|
||||||
fflush(hist_fp);
|
|
||||||
Index: misc/lnstat_util.c
|
|
||||||
===================================================================
|
|
||||||
--- misc/lnstat_util.c.orig
|
|
||||||
+++ misc/lnstat_util.c
|
|
||||||
@@ -49,7 +49,8 @@ static int scan_lines(struct lnstat_file
|
|
||||||
|
|
||||||
num_lines++;
|
|
||||||
|
|
||||||
- fgets(buf, sizeof(buf)-1, lf->fp);
|
|
||||||
+ char* res = 0;
|
|
||||||
+ res = fgets(buf, sizeof(buf)-1, lf->fp);
|
|
||||||
gettimeofday(&lf->last_read, NULL);
|
|
||||||
|
|
||||||
for (j = 0; j < lf->num_fields; j++) {
|
|
||||||
@@ -89,12 +90,13 @@ int lnstat_update(struct lnstat_file *ln
|
|
||||||
for (lf = lnstat_files; lf; lf = lf->next) {
|
|
||||||
if (time_after(&lf->last_read, &lf->interval, &tv)) {
|
|
||||||
int i;
|
|
||||||
+ char* res = 0;
|
|
||||||
struct lnstat_field *lfi;
|
|
||||||
|
|
||||||
rewind(lf->fp);
|
|
||||||
if (!lf->compat) {
|
|
||||||
/* skip first line */
|
|
||||||
- fgets(buf, sizeof(buf)-1, lf->fp);
|
|
||||||
+ res = fgets(buf, sizeof(buf)-1, lf->fp);
|
|
||||||
}
|
|
||||||
scan_lines(lf, 1);
|
|
||||||
|
|
||||||
@@ -108,7 +110,7 @@ int lnstat_update(struct lnstat_file *ln
|
|
||||||
}
|
|
||||||
|
|
||||||
rewind(lf->fp);
|
|
||||||
- fgets(buf, sizeof(buf)-1, lf->fp);
|
|
||||||
+ res = fgets(buf, sizeof(buf)-1, lf->fp);
|
|
||||||
scan_lines(lf, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -140,9 +142,10 @@ static int __lnstat_scan_fields(struct l
|
|
||||||
static int lnstat_scan_fields(struct lnstat_file *lf)
|
|
||||||
{
|
|
||||||
char buf[FGETS_BUF_SIZE];
|
|
||||||
+ char* res = 0;
|
|
||||||
|
|
||||||
rewind(lf->fp);
|
|
||||||
- fgets(buf, sizeof(buf)-1, lf->fp);
|
|
||||||
+ res = fgets(buf, sizeof(buf)-1, lf->fp);
|
|
||||||
|
|
||||||
return __lnstat_scan_fields(lf, buf);
|
|
||||||
}
|
|
||||||
Index: misc/nstat.c
|
|
||||||
===================================================================
|
|
||||||
--- misc/nstat.c.orig
|
|
||||||
+++ misc/nstat.c
|
|
||||||
@@ -567,8 +567,9 @@ int main(int argc, char *argv[])
|
|
||||||
fclose(tfp);
|
|
||||||
}
|
|
||||||
if (uptime >= 0 && time(NULL) >= stb.st_mtime+uptime) {
|
|
||||||
+ int res = 0;
|
|
||||||
fprintf(stderr, "nstat: history is aged out, resetting\n");
|
|
||||||
- ftruncate(fileno(hist_fp), 0);
|
|
||||||
+ res = ftruncate(fileno(hist_fp), 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -612,7 +613,8 @@ int main(int argc, char *argv[])
|
|
||||||
dump_incr_db(stdout);
|
|
||||||
}
|
|
||||||
if (!no_update) {
|
|
||||||
- ftruncate(fileno(hist_fp), 0);
|
|
||||||
+ int res = 0;
|
|
||||||
+ res = ftruncate(fileno(hist_fp), 0);
|
|
||||||
rewind(hist_fp);
|
|
||||||
dump_kern_db(hist_fp, 1);
|
|
||||||
fflush(hist_fp);
|
|
||||||
Index: misc/rtacct.c
|
|
||||||
===================================================================
|
|
||||||
--- misc/rtacct.c.orig
|
|
||||||
+++ misc/rtacct.c
|
|
||||||
@@ -562,8 +562,10 @@ int main(int argc, char *argv[])
|
|
||||||
fprintf(stderr, "rtacct: something is so wrong with history file, that I prefer not to proceed.\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
- if (stb.st_size != sizeof(*hist_db))
|
|
||||||
- write(fd, kern_db, sizeof(*hist_db));
|
|
||||||
+ if (stb.st_size != sizeof(*hist_db)) {
|
|
||||||
+ ssize_t res = 0;
|
|
||||||
+ res = write(fd, kern_db, sizeof(*hist_db));
|
|
||||||
+ }
|
|
||||||
|
|
||||||
hist_db = mmap(NULL, sizeof(*hist_db),
|
|
||||||
PROT_READ|PROT_WRITE,
|
|
||||||
Index: misc/ss.c
|
|
||||||
===================================================================
|
|
||||||
--- misc/ss.c.orig
|
|
||||||
+++ misc/ss.c
|
|
||||||
@@ -290,7 +290,8 @@ static void user_ent_hash_build(void)
|
|
||||||
|
|
||||||
snprintf(tmp, sizeof(tmp), "%s/%d/stat", root, pid);
|
|
||||||
if ((fp = fopen(tmp, "r")) != NULL) {
|
|
||||||
- fscanf(fp, "%*d (%[^)])", process);
|
|
||||||
+ int res = 0;
|
|
||||||
+ res = fscanf(fp, "%*d (%[^)])", process);
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -372,7 +373,8 @@ int get_slabstat(struct slabstat *s)
|
|
||||||
|
|
||||||
cnt = sizeof(*s)/sizeof(int);
|
|
||||||
|
|
||||||
- fgets(buf, sizeof(buf), fp);
|
|
||||||
+ char* res = 0;
|
|
||||||
+ res = fgets(buf, sizeof(buf), fp);
|
|
||||||
while(fgets(buf, sizeof(buf), fp) != NULL) {
|
|
||||||
int i;
|
|
||||||
for (i=0; i<sizeof(slabstat_ids)/sizeof(slabstat_ids[0]); i++) {
|
|
||||||
@@ -496,7 +498,8 @@ void init_service_resolver(void)
|
|
||||||
char buf[128];
|
|
||||||
FILE *fp = popen("/usr/sbin/rpcinfo -p 2>/dev/null", "r");
|
|
||||||
if (fp) {
|
|
||||||
- fgets(buf, sizeof(buf), fp);
|
|
||||||
+ char* res = 0;
|
|
||||||
+ res = fgets(buf, sizeof(buf), fp);
|
|
||||||
while (fgets(buf, sizeof(buf), fp) != NULL) {
|
|
||||||
unsigned int progn, port;
|
|
||||||
char proto[128], prog[128];
|
|
||||||
@@ -534,7 +537,8 @@ static int is_ephemeral(int port)
|
|
||||||
if (!ip_local_port_min) {
|
|
||||||
FILE *f = ephemeral_ports_open();
|
|
||||||
if (f) {
|
|
||||||
- fscanf(f, "%d %d",
|
|
||||||
+ int res = 0;
|
|
||||||
+ res = fscanf(f, "%d %d",
|
|
||||||
&ip_local_port_min, &ip_local_port_max);
|
|
||||||
fclose(f);
|
|
||||||
} else {
|
|
||||||
@@ -711,7 +715,8 @@ int run_ssfilter(struct ssfilter *f, str
|
|
||||||
if (!low) {
|
|
||||||
FILE *fp = ephemeral_ports_open();
|
|
||||||
if (fp) {
|
|
||||||
- fscanf(fp, "%d%d", &low, &high);
|
|
||||||
+ int res = 0;
|
|
||||||
+ res = fscanf(fp, "%d%d", &low, &high);
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1555,8 +1560,10 @@ static int tcp_show_netlink(struct filte
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (dump_fp)
|
|
||||||
- fwrite(buf, 1, NLMSG_ALIGN(status), dump_fp);
|
|
||||||
+ if (dump_fp) {
|
|
||||||
+ size_t res = 0;
|
|
||||||
+ res = fwrite(buf, 1, NLMSG_ALIGN(status), dump_fp);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
h = (struct nlmsghdr*)buf;
|
|
||||||
while (NLMSG_OK(h, status)) {
|
|
||||||
@@ -1993,9 +2000,11 @@ int unix_show(struct filter *f)
|
|
||||||
int cnt;
|
|
||||||
struct unixstat *list = NULL;
|
|
||||||
|
|
||||||
- if ((fp = net_unix_open()) == NULL)
|
|
||||||
+ if ((fp = net_unix_open()) == NULL) {
|
|
||||||
return -1;
|
|
||||||
- fgets(buf, sizeof(buf)-1, fp);
|
|
||||||
+ }
|
|
||||||
+ char* res = 0;
|
|
||||||
+ res = fgets(buf, sizeof(buf)-1, fp);
|
|
||||||
|
|
||||||
if (memcmp(buf, "Peer", 4) == 0)
|
|
||||||
newformat = 1;
|
|
||||||
@@ -2081,9 +2090,11 @@ int packet_show(struct filter *f)
|
|
||||||
if (!(f->states & (1<<SS_CLOSE)))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
- if ((fp = net_packet_open()) == NULL)
|
|
||||||
+ if ((fp = net_packet_open()) == NULL) {
|
|
||||||
return -1;
|
|
||||||
- fgets(buf, sizeof(buf)-1, fp);
|
|
||||||
+ }
|
|
||||||
+ char* res = 0;
|
|
||||||
+ res = fgets(buf, sizeof(buf)-1, fp);
|
|
||||||
|
|
||||||
while (fgets(buf, sizeof(buf)-1, fp)) {
|
|
||||||
sscanf(buf, "%llx %*d %d %x %d %d %u %u %u",
|
|
||||||
@@ -2154,9 +2165,11 @@ int netlink_show(struct filter *f)
|
|
||||||
if (!(f->states & (1<<SS_CLOSE)))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
- if ((fp = net_netlink_open()) == NULL)
|
|
||||||
+ if ((fp = net_netlink_open()) == NULL) {
|
|
||||||
return -1;
|
|
||||||
- fgets(buf, sizeof(buf)-1, fp);
|
|
||||||
+ }
|
|
||||||
+ char* res = 0;
|
|
||||||
+ res = fgets(buf, sizeof(buf)-1, fp);
|
|
||||||
|
|
||||||
while (fgets(buf, sizeof(buf)-1, fp)) {
|
|
||||||
sscanf(buf, "%llx %d %d %x %d %d %llx %d",
|
|
||||||
Index: netem/maketable.c
|
|
||||||
===================================================================
|
|
||||||
--- netem/maketable.c.orig
|
|
||||||
+++ netem/maketable.c
|
|
||||||
@@ -38,7 +38,8 @@ readdoubles(FILE *fp, int *number)
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0; i<limit; ++i){
|
|
||||||
- fscanf(fp, "%lf", &x[i]);
|
|
||||||
+ int res = 0;
|
|
||||||
+ res = fscanf(fp, "%lf", &x[i]);
|
|
||||||
if (feof(fp))
|
|
||||||
break;
|
|
||||||
++n;
|
|
@ -1,197 +0,0 @@
|
|||||||
From ff2e5a2ada6196ce4ed89a76b5e86f047c9a63f4 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Marius Tomaschewski <mt@suse.de>
|
|
||||||
Date: Wed, 12 Jan 2011 16:41:45 +0100
|
|
||||||
Subject: [PATCH] ip route rtt metrics time unit is milliseconds
|
|
||||||
|
|
||||||
Adopted ip route rtt,rttvar,rto_min metrics time unit to milliseconds
|
|
||||||
instead of jiffies as required by recent kernels (>=2.6.27).
|
|
||||||
|
|
||||||
Added an get_rtt_metrics_units function providing the unit and the
|
|
||||||
get_time_in_units as successor of get_jiffies function, allowing to
|
|
||||||
specify the unit. The get_rtt_metrics_units can be extended to detect
|
|
||||||
and handle also older kernels.
|
|
||||||
|
|
||||||
This fixes also the inconsistent use of get_user_hz in print_route
|
|
||||||
and get_hz in get_jiffies function that return different units.
|
|
||||||
---
|
|
||||||
include/utils.h | 1 +
|
|
||||||
ip/iproute.c | 38 ++++++++++++++++++++++++++------------
|
|
||||||
lib/utils.c | 24 +++++++++++++-----------
|
|
||||||
3 files changed, 40 insertions(+), 23 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/include/utils.h b/include/utils.h
|
|
||||||
index 3da6998..3d98c01 100644
|
|
||||||
--- a/include/utils.h
|
|
||||||
+++ b/include/utils.h
|
|
||||||
@@ -80,6 +80,7 @@ extern int mask2bits(__u32 netmask);
|
|
||||||
extern int get_integer(int *val, const char *arg, int base);
|
|
||||||
extern int get_unsigned(unsigned *val, const char *arg, int base);
|
|
||||||
extern int get_jiffies(unsigned *val, const char *arg, int base, int *raw);
|
|
||||||
+extern int get_time_in_units(unsigned *val, const char *arg, int base, int *raw, unsigned unit);
|
|
||||||
#define get_byte get_u8
|
|
||||||
#define get_ushort get_u16
|
|
||||||
#define get_short get_s16
|
|
||||||
diff --git a/ip/iproute.c b/ip/iproute.c
|
|
||||||
index 0d69290..830b0a3 100644
|
|
||||||
--- a/ip/iproute.c
|
|
||||||
+++ b/ip/iproute.c
|
|
||||||
@@ -33,6 +33,21 @@
|
|
||||||
#define RTAX_RTTVAR RTAX_HOPS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+#define TIME_UNIT_MS 1000
|
|
||||||
+
|
|
||||||
+static unsigned get_rtt_metrics_units(void)
|
|
||||||
+{
|
|
||||||
+ /*
|
|
||||||
+ * recent kernels (>=2.6.27) are using milliseconds base.
|
|
||||||
+ * Note: To support older kernels, return the proper HZ...
|
|
||||||
+ *
|
|
||||||
+ * final unit for rto_min: unit
|
|
||||||
+ * rttvar: unit * 4
|
|
||||||
+ * rtt: unit * 8
|
|
||||||
+ */
|
|
||||||
+ return TIME_UNIT_MS;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
enum list_action {
|
|
||||||
IPROUTE_LIST,
|
|
||||||
IPROUTE_FLUSH,
|
|
||||||
@@ -522,12 +537,11 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
||||||
mxlock = *(unsigned*)RTA_DATA(mxrta[RTAX_LOCK]);
|
|
||||||
|
|
||||||
for (i=2; i<= RTAX_MAX; i++) {
|
|
||||||
- unsigned val;
|
|
||||||
+ unsigned long long val; /* val *= 1000 below */
|
|
||||||
+ unsigned unit = get_rtt_metrics_units();
|
|
||||||
|
|
||||||
if (mxrta[i] == NULL)
|
|
||||||
continue;
|
|
||||||
- if (!hz)
|
|
||||||
- hz = get_user_hz();
|
|
||||||
|
|
||||||
if (i < sizeof(mx_names)/sizeof(char*) && mx_names[i])
|
|
||||||
fprintf(fp, " %s", mx_names[i]);
|
|
||||||
@@ -543,24 +557,24 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
||||||
val = 0;
|
|
||||||
/* fall through */
|
|
||||||
default:
|
|
||||||
- fprintf(fp, " %u", val);
|
|
||||||
+ fprintf(fp, " %llu", val);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RTAX_RTT:
|
|
||||||
case RTAX_RTTVAR:
|
|
||||||
case RTAX_RTO_MIN:
|
|
||||||
- val *= 1000;
|
|
||||||
+ val *= TIME_UNIT_MS;
|
|
||||||
if (i == RTAX_RTT)
|
|
||||||
val /= 8;
|
|
||||||
else if (i == RTAX_RTTVAR)
|
|
||||||
val /= 4;
|
|
||||||
|
|
||||||
- if (val >= hz)
|
|
||||||
+ if (val >= unit)
|
|
||||||
fprintf(fp, " %llums",
|
|
||||||
- (unsigned long long) val / hz);
|
|
||||||
+ val / unit);
|
|
||||||
else
|
|
||||||
- fprintf(fp, " %.2fms",
|
|
||||||
- (double)val / hz);
|
|
||||||
+ fprintf(fp, " %.8fms",
|
|
||||||
+ (double)val / unit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -840,7 +854,7 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
|
|
||||||
mxlock |= (1<<RTAX_RTT);
|
|
||||||
NEXT_ARG();
|
|
||||||
}
|
|
||||||
- if (get_jiffies(&rtt, *argv, 0, &raw))
|
|
||||||
+ if (get_time_in_units(&rtt, *argv, 0, &raw, get_rtt_metrics_units()))
|
|
||||||
invarg("\"rtt\" value is invalid\n", *argv);
|
|
||||||
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_RTT,
|
|
||||||
(raw) ? rtt : rtt * 8);
|
|
||||||
@@ -848,7 +862,7 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
|
|
||||||
unsigned rto_min;
|
|
||||||
NEXT_ARG();
|
|
||||||
mxlock |= (1<<RTAX_RTO_MIN);
|
|
||||||
- if (get_jiffies(&rto_min, *argv, 0, &raw))
|
|
||||||
+ if (get_time_in_units(&rto_min, *argv, 0, &raw, get_rtt_metrics_units()))
|
|
||||||
invarg("\"rto_min\" value is invalid\n",
|
|
||||||
*argv);
|
|
||||||
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_RTO_MIN,
|
|
||||||
@@ -900,7 +914,7 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
|
|
||||||
mxlock |= (1<<RTAX_RTTVAR);
|
|
||||||
NEXT_ARG();
|
|
||||||
}
|
|
||||||
- if (get_jiffies(&win, *argv, 0, &raw))
|
|
||||||
+ if (get_time_in_units(&win, *argv, 0, &raw, get_rtt_metrics_units()))
|
|
||||||
invarg("\"rttvar\" value is invalid\n", *argv);
|
|
||||||
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_RTTVAR,
|
|
||||||
(raw) ? win : win * 4);
|
|
||||||
diff --git a/lib/utils.c b/lib/utils.c
|
|
||||||
index a60d884..a21a2ae 100644
|
|
||||||
--- a/lib/utils.c
|
|
||||||
+++ b/lib/utils.c
|
|
||||||
@@ -102,6 +102,11 @@ int get_unsigned(unsigned *val, const char *arg, int base)
|
|
||||||
|
|
||||||
int get_jiffies(unsigned *jiffies, const char *arg, int base, int *raw)
|
|
||||||
{
|
|
||||||
+ return get_time_in_units(jiffies, arg, base, raw, get_hz());
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int get_time_in_units(unsigned *val, const char *arg, int base, int *raw, unsigned unit)
|
|
||||||
+{
|
|
||||||
double t;
|
|
||||||
unsigned long res;
|
|
||||||
char *p;
|
|
||||||
@@ -120,37 +125,34 @@ int get_jiffies(unsigned *jiffies, const char *arg, int base, int *raw)
|
|
||||||
if (p == arg)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
- if (__iproute2_hz_internal == 0)
|
|
||||||
- __iproute2_hz_internal = __get_hz();
|
|
||||||
-
|
|
||||||
*raw = 1;
|
|
||||||
|
|
||||||
if (*p) {
|
|
||||||
*raw = 0;
|
|
||||||
if (strcasecmp(p, "s") == 0 || strcasecmp(p, "sec")==0 ||
|
|
||||||
strcasecmp(p, "secs")==0)
|
|
||||||
- t *= __iproute2_hz_internal;
|
|
||||||
+ t *= unit;
|
|
||||||
else if (strcasecmp(p, "ms") == 0 || strcasecmp(p, "msec")==0 ||
|
|
||||||
strcasecmp(p, "msecs") == 0)
|
|
||||||
- t *= __iproute2_hz_internal/1000.0;
|
|
||||||
+ t *= unit/1000.0;
|
|
||||||
else if (strcasecmp(p, "us") == 0 || strcasecmp(p, "usec")==0 ||
|
|
||||||
strcasecmp(p, "usecs") == 0)
|
|
||||||
- t *= __iproute2_hz_internal/1000000.0;
|
|
||||||
+ t *= unit/1000000.0;
|
|
||||||
else if (strcasecmp(p, "ns") == 0 || strcasecmp(p, "nsec")==0 ||
|
|
||||||
strcasecmp(p, "nsecs") == 0)
|
|
||||||
- t *= __iproute2_hz_internal/1000000000.0;
|
|
||||||
+ t *= unit/1000000000.0;
|
|
||||||
else if (strcasecmp(p, "j") == 0 || strcasecmp(p, "hz") == 0 ||
|
|
||||||
strcasecmp(p,"jiffies") == 0)
|
|
||||||
- t *= 1.0; /* allow suffix, do nothing */
|
|
||||||
+ t *= unit/(double)get_hz();
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* emulate ceil() without having to bring-in -lm and always be >= 1 */
|
|
||||||
|
|
||||||
- *jiffies = t;
|
|
||||||
- if (*jiffies < t)
|
|
||||||
- *jiffies += 1;
|
|
||||||
+ *val = t;
|
|
||||||
+ if (*val < t)
|
|
||||||
+ *val += 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
--
|
|
||||||
1.7.1
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:71754f8ad68facdb97d0cb9d7a298dc7f1ba069370bce902b661e06959f264e3
|
|
||||||
size 388866
|
|
3
iproute2-2.6.38.tar.bz2
Normal file
3
iproute2-2.6.38.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:47629a4f547f21d94d8e823a87dd8e13042cadecefea2e2dc433e4134fa9aec4
|
||||||
|
size 390166
|
@ -1,3 +1,24 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Mar 23 18:57:20 UTC 2011 - bphilips@novell.com
|
||||||
|
|
||||||
|
Remove unneeded patches:
|
||||||
|
* iproute2-warnings.diff bnc#34714
|
||||||
|
Warnings no longer exist
|
||||||
|
* iproute2-iptunnel-fclose.diff
|
||||||
|
Process is dying no need to close file pointers
|
||||||
|
* iproute2-ss-pclose.diff
|
||||||
|
Process is dying no need to close file pointers
|
||||||
|
* iproute2-flushcheckuid.diff
|
||||||
|
Fixed upstream
|
||||||
|
* iproute2-skbedit-memset.diff
|
||||||
|
Fixed upstream 46a6573259f46f86eb0048a2c805b24ff4183fa6
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Mar 22 08:57:44 CET 2011 - ms@suse.de
|
||||||
|
|
||||||
|
- Update to 2.6.38, fix for options process with ipt (bnc #679172)
|
||||||
|
- tidy up the package, spec file names, patch names, etc
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Jan 12 16:02:26 UTC 2011 - mt@suse.de
|
Wed Jan 12 16:02:26 UTC 2011 - mt@suse.de
|
||||||
|
|
||||||
|
@ -24,22 +24,16 @@ BuildRequires: iptables-devel
|
|||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: Productivity/Networking/Routing
|
Group: Productivity/Networking/Routing
|
||||||
Provides: iproute
|
Provides: iproute
|
||||||
Version: 2.6.37
|
Version: 2.6.38
|
||||||
Release: 1
|
Release: 1
|
||||||
%define rversion 2.6.37
|
%define rversion 2.6.38
|
||||||
Summary: Advanced Routing
|
Summary: Advanced Routing
|
||||||
Url: http://developer.osdl.org/dev/iproute2/
|
Url: http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
|
||||||
Source0: %name-%rversion.tar.bz2
|
Source0: %name-%rversion.tar.bz2
|
||||||
Patch0: %name-2.6.29-1-libdir-1.diff
|
Patch0: %name-libdir-1.diff
|
||||||
Patch1: %name-2.6.29-1-HZ.diff
|
Patch1: %name-HZ.diff
|
||||||
Patch2: %name-2.6.29-1-pdfdoc.diff
|
Patch2: %name-pdfdoc.diff
|
||||||
Patch5: %name-2.6.29-1-flushcheckuid.diff
|
Patch3: %name-memleak.diff
|
||||||
Patch7: %name-2.6.29-1-warnings.diff
|
|
||||||
Patch8: %name-2.6.29-1-skbedit-memset.diff
|
|
||||||
Patch9: %name-2.6.29-1-iptunnel-fclose.diff
|
|
||||||
Patch10: %name-2.6.29-1-ss-pclose.diff
|
|
||||||
Patch13: %name-2.6.29-1-memleak.diff
|
|
||||||
Patch14: %name-2.6.37-rtt-metrics-units.diff
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -79,13 +73,7 @@ as well as examples and other outdated files.
|
|||||||
%patch0
|
%patch0
|
||||||
%patch1
|
%patch1
|
||||||
%patch2
|
%patch2
|
||||||
%patch5
|
%patch3
|
||||||
%patch7
|
|
||||||
%patch8
|
|
||||||
%patch9
|
|
||||||
%patch10
|
|
||||||
%patch13
|
|
||||||
%patch14 -p1
|
|
||||||
find . -name *.orig -print0 | xargs -r0 rm -v
|
find . -name *.orig -print0 | xargs -r0 rm -v
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
Loading…
Reference in New Issue
Block a user