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

------------------------------------------------------------------------------
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