>and it should be fixed the the next 5.7.3.pre release.

That's great. I also found the same netmask problem in the route deletion
method (_netsnmp_ioctl_route_delete_v4) which is in the same source file
(route_ioctl.c). However, route deletion only works after a restart of
snmpd, and crashes snmpd if a route was previously added during the same
runtime instance. I think this issue lies with route caching, but I have not
looked much into it.

Regards,
Daniel

-----Original Message-----
From: Niels Baggesen [mailto:n...@users.sourceforge.net] 
Sent: Monday, January 27, 2014 4:29 PM
To: Daniel Tingstrom; net-snmp-coders@lists.sourceforge.net
Subject: Re: Creating inetCidrRouteTable row entries

Den 21-01-2014 16:32, Daniel Tingstrom skrev:
> I couldn't find an existing function to convert a prefix length to a 
> netmask, so I just wrote my own. Net SNMP version is 5.7.2. Here is 
> the
> patch:

Thanks for finding this!

> --- route_ioctl.c.old 2012-10-09 18:28:58.000000000 -0400
> +++ route_ioctl.c     2014-01-21 10:30:32.239381288 -0500
> @@ -114,7 +114,7 @@
>       DEBUGMSGTL(("access:route","    via %s\n", DEBUGSTR));
>
>       mask.sin_family = AF_INET;
> -    mask.sin_addr.s_addr = htonl(0);
> +    mask.sin_addr.s_addr = entry->rt_pfx_len ? htonl((( ((uint32_t)1) 
> + <<
> (32-entry->rt_pfx_len)) - 1) ^ 0xffffffffU) : 0;
>       DEBUGSTR = inet_ntoa(mask.sin_addr);
>       DEBUGMSGTL(("access:route","    mask %s\n", DEBUGSTR));

Thanks for the patch. I did create a function for converting prefix to mask,
and it should be fixed the the next 5.7.3.pre release.

/Niels

--
Niels Baggesen - @home - Ã…rhus - Denmark - n...@users.sourceforge.net
The purpose of computing is insight, not numbers   ---   R W Hamming

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