TT#14008 fix seq_file usage

If the seq_file buffer overflows, the printing of the last item is
re-tried following a stop/start event on the seq_file. Therefore we
cannot unconditionally increase the offset whenever our `next` method is
called.

closes #1244

Change-Id: I7026deeeb03423cc2da57b1e069019638cf734cf
pull/1252/head
Richard Fuchs 4 years ago
parent ec42f83353
commit 9d4b870b0f

@ -1319,7 +1319,6 @@ next_rda:
*addr_bucket = ab;
*port = (hi << 8) | lo;
(*port)++;
return g;
}
@ -1383,6 +1382,7 @@ static ssize_t proc_blist_read(struct file *f, char __user *b, size_t l, loff_t
addr_bucket = ((int) *o) >> 17;
port = ((int) *o) & 0x1ffff;
g = find_next_target(t, &addr_bucket, &port);
port++;
*o = (addr_bucket << 17) | port;
err = 0;
if (!g)
@ -1465,7 +1465,7 @@ static void *proc_list_start(struct seq_file *f, loff_t *o) {
static void proc_list_stop(struct seq_file *f, void *v) {
}
static void *proc_list_next(struct seq_file *f, void *v, loff_t *o) { /* v is invalid */
static void *proc_list_next(struct seq_file *f, void *v, loff_t *o) {
u_int32_t id = (u_int32_t) (unsigned long) f->private;
struct rtpengine_table *t;
struct rtpengine_target *g;
@ -1478,6 +1478,9 @@ static void *proc_list_next(struct seq_file *f, void *v, loff_t *o) { /* v is in
if (!t)
return NULL;
if (v) // this is a `next` call
port++;
g = find_next_target(t, &addr_bucket, &port);
*o = (addr_bucket << 17) | port;

Loading…
Cancel
Save