Hi, 

I need to add a static route entry in linux via SNMP. So I am using
inetCidrRouteTable. Unfortunately, the implementation of
_netsnmp_ioctl_route_set_v4() in route_ioctl.c always hardcodes the route's
netmask to 0.0.0.0, allowing only default gateway routes to be added. 

I had to manually change the following line:

mask.sin_addr.s_addr = htonl(0);

to:

mask.sin_addr.s_addr = htonl(0xffff0000);

for the following snmpset command to work:

snmpset -l authPriv -A password -X password -a SHA -x AES -u authPrivUser
localhost
IP-FORWARD-MIB::inetCidrRouteStatus.1.4.20.20.0.0.16.2.0.0.1.4.10.10.0.1 i 4
IP-FORWARD-MIB::inetCidrRouteIfIndex.1.4.20.20.0.0.16.2.0.0.1.4.10.10.0.1 i
3 IP-FORWARD-MIB::inetCidrRouteMetric1.1.4.20.20.0.0.16.2.0.0.1.4.10.10.0.1
i 0 IP-FORWARD-MIB::inetCidrRouteType.1.4.20.20.0.0.16.2.0.0.1.4.10.10.0.1 i
4

I want to do the equivalent of: ip route add 20.20.0.0/16 via 10.10.0.1

I am new to SNMP and so I could be doing this wrong or making incorrect
assumptions. Perhaps there is an alternative method to adding static routes
that are not default gateways? Or is this simply a bug?

Thanks,
Daniel


Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to