Re: [PATCH 0/6] Add support for interface binding
Bart Van Assche <[email protected]>
| Newsgroups | gmane.network.net-snmp.devel |
|---|---|
| Message-ID | <[email protected]> |
On 1/22/19 12:40 PM, Bill Fenner wrote: > On Wed, Nov 7, 2018 at 1:26 AM Bart Van Assche <[email protected] > <mailto:[email protected]>> wrote: > > On 11/6/18 8:03 AM, Bill Fenner wrote: > > Given your proposed code structure, I imagine that we could add > network > > namespaces to netsnmp_ep too - this basically ends up using > "socketat( > > /* magic */, family, type, protocol )" instead of socket() to > create the > > socket, and the magic can be derived from what we store in ep. > > That sounds like a good idea to me. > > > I've finally done this, and would like to request some eyes on it before > I push it to 5-8-patches. > > https://github.com/fenner/net-snmp/compare/V5-8-patches...fenner:linux-namespace Hi Bill, The following new code in netsnmp_parse_ep_str() looks a bit fragile to me: cp = strchr(iface, '@'); if (!cp) cp = strchr(iface, ':'); Wouldn't it be better to backtrack to the previous value of 'cp' if no second '@' sign is found? That will avoid that this code fails if support for a new delimiter between '@' and ':' would be added. The following code looks unusual to me: #ifdef HAVE_SETNS #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/socket.h> #include <unistd.h> #include <signal.h> #include <sched.h> #include <net-snmp/library/snmp_assert.h> #endif I'm not aware of any other Net-SNMP code that guards include directives with the result of a test for a system call. Otherwise the code looks fine to me. But please keep in mind that I only had a quick look at it. Bart.