On 17 March 2018 at 19:30, Dagfinn Reiakvam dagfinn@reiakvam.no wrote:
IN_ADDR temp;
temp.S_un.S_addr = 0xffffffff << ( 32 - MaskLength);
*Mask = temp.S_un.S_un_b.s_b4 + ( temp.S_un.S_un_b.s_b3 << 8 ) + ( temp.S_un.S_un_b.s_b2 << 16 ) + ( temp.S_un.S_un_b.s_b1 << 24 );
Should that be "*mask = htonl(~0u << (32 - mask_len));"?
The tests would probably benefit from htonl() as well.