route: fix for 64-bit BE machines by Seonghun Lim (wariua AT gmail.com)

This commit is contained in:
Denis Vlasenko 2008-09-28 23:39:18 +00:00
parent 22eb410d66
commit 58680706d7

View File

@ -302,7 +302,7 @@ static void INET_setroute(int action, char **args)
/* sanity checks.. */ /* sanity checks.. */
if (mask_in_addr(rt)) { if (mask_in_addr(rt)) {
unsigned long mask = mask_in_addr(rt); uint32_t mask = mask_in_addr(rt);
mask = ~ntohl(mask); mask = ~ntohl(mask);
if ((rt.rt_flags & RTF_HOST) && mask != 0xffffffff) { if ((rt.rt_flags & RTF_HOST) && mask != 0xffffffff) {
@ -313,7 +313,7 @@ static void INET_setroute(int action, char **args)
bb_error_msg_and_die("bogus netmask %s", netmask); bb_error_msg_and_die("bogus netmask %s", netmask);
} }
mask = ((struct sockaddr_in *) &rt.rt_dst)->sin_addr.s_addr; mask = ((struct sockaddr_in *) &rt.rt_dst)->sin_addr.s_addr;
if (mask & ~mask_in_addr(rt)) { if (mask & ~(uint32_t)mask_in_addr(rt)) {
bb_error_msg_and_die("netmask and route address conflict"); bb_error_msg_and_die("netmask and route address conflict");
} }
} }