IP-MIB::ipForwarding.0 should return one of these values:

ipForwarding OBJECT-TYPE
    SYNTAX     INTEGER {
                    forwarding(1),    -- acting as a router
                    notForwarding(2)  -- NOT acting as a router
               }

Currently we directly return the value of sysctl net.inet.ip.forwarding
which is incorrect.

OK to fix it like this?

Index: mib.c
===================================================================
RCS file: /cvs/src/usr.sbin/snmpd/mib.c,v
retrieving revision 1.76
diff -u -p -r1.76 mib.c
--- mib.c       10 Jun 2015 10:03:59 -0000      1.76
+++ mib.c       7 Oct 2015 21:34:27 -0000
@@ -2984,7 +2984,7 @@ mib_ipforwarding(struct oid *oid, struct
        if (sysctl(mib, sizeofa(mib), &v, &len, NULL, 0) == -1)
                return (-1);
 
-       *elm = ber_add_integer(*elm, v);
+       *elm = ber_add_integer(*elm, v ? 1 : 2);
 
        return (0);
 }

Reply via email to