Commit 0cfb9f6a authored by Stephen Hemminger's avatar Stephen Hemminger

Merge branch 'master' into net-next

parents 29d61fb3 338b003b
......@@ -223,7 +223,7 @@ int rtnl_dump_filter_l(struct rtnl_handle *rth,
.msg_iov = &iov,
.msg_iovlen = 1,
};
char buf[16384];
char buf[32768];
int dump_intr = 0;
iov.iov_base = buf;
......
......@@ -589,7 +589,7 @@ static void server_loop(int fd)
for (;;) {
int status;
int tdiff;
time_t tdiff;
struct timeval now;
gettimeofday(&now, NULL);
......@@ -600,7 +600,7 @@ static void server_loop(int fd)
tdiff = 0;
}
if (poll(&p, 1, tdiff + scan_interval) > 0
if (poll(&p, 1, scan_interval - tdiff) > 0
&& (p.revents&POLLIN)) {
int clnt = accept(fd, NULL, NULL);
if (clnt >= 0) {
......@@ -613,11 +613,8 @@ static void server_loop(int fd)
close(clnt);
} else {
FILE *fp = fdopen(clnt, "w");
if (fp) {
if (tdiff > 0)
update_db(tdiff);
if (fp)
dump_raw_db(fp, 0);
}
exit(0);
}
}
......
......@@ -433,7 +433,7 @@ static void server_loop(int fd)
for (;;) {
int status;
int tdiff;
time_t tdiff;
struct timeval now;
gettimeofday(&now, NULL);
tdiff = T_DIFF(now, snaptime);
......@@ -442,7 +442,7 @@ static void server_loop(int fd)
snaptime = now;
tdiff = 0;
}
if (poll(&p, 1, tdiff + scan_interval) > 0
if (poll(&p, 1, scan_interval - tdiff) > 0
&& (p.revents&POLLIN)) {
int clnt = accept(fd, NULL, NULL);
if (clnt >= 0) {
......@@ -455,11 +455,8 @@ static void server_loop(int fd)
close(clnt);
} else {
FILE *fp = fdopen(clnt, "w");
if (fp) {
if (tdiff > 0)
update_db(tdiff);
if (fp)
dump_kern_db(fp, 0);
}
exit(0);
}
}
......
......@@ -153,8 +153,6 @@ pack_key32(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey)
tkey->val = htonl(tkey->val & retain);
tkey->mask = htonl(tkey->mask | ~retain);
/* jamal remove this - it is not necessary given the if check above */
tkey->off &= ~3;
return pack_key(sel,tkey);
}
......@@ -177,11 +175,8 @@ pack_key16(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey)
}
stride = 8 * ind;
tkey->val = htons(tkey->val);
tkey->val <<= stride;
tkey->mask <<= stride;
retain <<= stride;
tkey->mask = retain|m[ind];
tkey->val = htons(tkey->val & retain) << stride;
tkey->mask = (htons(tkey->mask | ~retain) << stride) | m[ind];
tkey->off &= ~3;
......@@ -205,10 +200,8 @@ pack_key8(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey)
ind = tkey->off & 3;
stride = 8 * ind;
tkey->val <<= stride;
tkey->mask <<= stride;
retain <<= stride;
tkey->mask = retain|m[ind];
tkey->val = (tkey->val & retain) << stride;
tkey->mask = ((tkey->mask | ~retain) << stride) | m[ind];
tkey->off &= ~3;
......@@ -269,13 +262,13 @@ parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type,__u32 retain,struct t
o = 0xFFFFFFFF;
if (matches(*argv, "invert") == 0) {
retain = val = mask = o;
val = mask = o;
} else if (matches(*argv, "set") == 0) {
NEXT_ARG();
if (parse_val(&argc, &argv, &val, type))
return -1;
} else if (matches(*argv, "preserve") == 0) {
retain = mask = o;
retain = 0;
} else {
if (matches(*argv, "clear") != 0)
return -1;
......@@ -291,19 +284,17 @@ parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type,__u32 retain,struct t
}
tkey->val = val;
tkey->mask = mask;
if (len == 1) {
tkey->mask = 0xFF;
res = pack_key8(retain,sel,tkey);
goto done;
}
if (len == 2) {
tkey->mask = mask;
res = pack_key16(retain,sel,tkey);
goto done;
}
if (len == 4) {
tkey->mask = mask;
res = pack_key32(retain,sel,tkey);
goto done;
}
......@@ -422,6 +413,7 @@ parse_munge(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel)
p = get_pedit_kind(k);
if (NULL == p)
goto bad_val;
NEXT_ARG();
res = p->parse_peopt(&argc, &argv, sel,&tkey);
if (res < 0) {
fprintf(stderr,"bad pedit parsing\n");
......
......@@ -58,7 +58,7 @@ parse_ip(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_ke
if (strcmp(*argv, "ihl") == 0) {
NEXT_ARG();
tkey->off = 0;
res = parse_cmd(&argc, &argv, 1, TU32,RU8,sel,tkey);
res = parse_cmd(&argc, &argv, 1, TU32,0x0f,sel,tkey);
goto done;
}
if (strcmp(*argv, "protocol") == 0) {
......
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