Re: [PATCH 0/6] Add support for interface binding
Bill Fenner via Net-snmp-coders <[email protected]>
| Newsgroups | gmane.network.net-snmp.devel |
|---|---|
| Message-ID | <CAF4SogbRsG-GiqOvqAKvwNg8+ucSqoFp+AcX-4i7MSSQfCwBCQ@mail.gmail.com> |
On Wed, Jan 23, 2019 at 10:17 PM Bart Van Assche <[email protected]> wrote: > On 1/23/19 9:43 AM, Bill Fenner wrote: > > The pattern I was trying to follow from the existing code appeared to be > > basically > > > > if (cp == delimiter of optional section) { > > *cp = '\0'; /* terminate previous section at delimiter */ > > this = cp + 1; /* handle this section */ > > cp = ... /* find next optional delimiter or NULL */ > > } > > > > Are you suggesting instead to put the "find next optional delimiter" > > code between sections, e.g., > > > > /* parse IP address, cp still points at beginning of address */ > > maybeintf = strchr( cp, '@' ); > > if (maybeintf) { > > *maybeintf = '\0'; > > cp = maybeintf + 1; > > intf = cp; > > } > > maybens = strchr( cp, '@' ); > > if (maybens) { > > ... > > } > > maybeport = strchr( cp, ':' ); > > if (maybeport) { > > ... > > } > > Hi Bill, > > No matter which approach will be chosen, please add test cases into > testing/fulltests/unit-tests/T022netsnmp_parse_ep_str_clib.c. There are several new test cases for namespace names in what’s on github now, and in a revision I haven’t pushed yet I added some corner cases like “hostname@@“ and “hostname@@:”. Was there anything else you thought was missing? (Thanks for having written that test, by the way; it helped me find a bug in my initial code.) Thanks, Bill _______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders