aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/inetdevice.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 5a0ab04627bc..c0f7aec331c2 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -124,12 +124,13 @@ static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
124 * Check if a mask is acceptable. 124 * Check if a mask is acceptable.
125 */ 125 */
126 126
127static __inline__ int bad_mask(u32 mask, u32 addr) 127static __inline__ int bad_mask(__be32 mask, __be32 addr)
128{ 128{
129 __u32 hmask;
129 if (addr & (mask = ~mask)) 130 if (addr & (mask = ~mask))
130 return 1; 131 return 1;
131 mask = ntohl(mask); 132 hmask = ntohl(mask);
132 if (mask & (mask+1)) 133 if (hmask & (hmask+1))
133 return 1; 134 return 1;
134 return 0; 135 return 0;
135} 136}
@@ -190,11 +191,12 @@ static __inline__ __be32 inet_make_mask(int logmask)
190 return 0; 191 return 0;
191} 192}
192 193
193static __inline__ int inet_mask_len(__u32 mask) 194static __inline__ int inet_mask_len(__be32 mask)
194{ 195{
195 if (!(mask = ntohl(mask))) 196 __u32 hmask = ntohl(mask);
197 if (!hmask)
196 return 0; 198 return 0;
197 return 32 - ffz(~mask); 199 return 32 - ffz(~hmask);
198} 200}
199 201
200 202