From 169aa63ec5a670d0c72b7e9fb747e16d76b718c3 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sat, 20 May 2023 14:09:41 +0000 Subject: devip: provide large buffer for ipifc->local() generator The ipifc->local generator is the big exception, dumping the whole link structure of the interface. --- sys/src/9/ip/devip.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'sys/src/9/ip/devip.c') diff --git a/sys/src/9/ip/devip.c b/sys/src/9/ip/devip.c index 032f53104..8a9824c10 100644 --- a/sys/src/9/ip/devip.c +++ b/sys/src/9/ip/devip.c @@ -93,7 +93,7 @@ ip3gen(Chan *c, int i, Dir *dp) p = "remote"; break; case Qsnoop: - if(strcmp(cv->p->name, "ipifc") != 0) + if(cv->p != ipfs[c->dev]->ipifc) return -1; devdir(c, q, "snoop", qlen(cv->sq), cv->owner, 0400, dp); return 1; @@ -674,13 +674,22 @@ ipread(Chan *ch, void *a, long n, vlong off) } goto Readstr; case Qlocal: + x = f->p[PROTO(ch->qid)]; + c = x->conv[CONV(ch->qid)]; + if(x == f->ipifc && x->local != nil){ + buf = smalloc(Maxstate); + if(waserror()){ + free(buf); + nexterror(); + } + (*x->local)(c, buf, Maxstate); + goto Readstr; + } buf = smalloc(Maxstring); if(waserror()){ free(buf); nexterror(); } - x = f->p[PROTO(ch->qid)]; - c = x->conv[CONV(ch->qid)]; if(x->local == nil) { snprint(buf, Maxstring, "%I!%d\n", c->laddr, c->lport); } else { -- cgit v1.2.3