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