diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-29 06:54:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-29 06:54:01 -0500 |
commit | 0ba6c33bcddc64a54b5f1c25a696c4767dc76292 (patch) | |
tree | 62e616f97a4762d8e75bf732e4827af2d15d52c5 /include/linux/in.h | |
parent | 21af0297c7e56024a5ccc4d8ad2a590f9ec371ba (diff) | |
parent | 85040bcb4643cba578839e953f25e2d1965d83d0 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.25
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.25: (1470 commits)
[IPV6] ADDRLABEL: Fix double free on label deletion.
[PPP]: Sparse warning fixes.
[IPV4] fib_trie: remove unneeded NULL check
[IPV4] fib_trie: More whitespace cleanup.
[NET_SCHED]: Use nla_policy for attribute validation in ematches
[NET_SCHED]: Use nla_policy for attribute validation in actions
[NET_SCHED]: Use nla_policy for attribute validation in classifiers
[NET_SCHED]: Use nla_policy for attribute validation in packet schedulers
[NET_SCHED]: sch_api: introduce constant for rate table size
[NET_SCHED]: Use typeful attribute parsing helpers
[NET_SCHED]: Use typeful attribute construction helpers
[NET_SCHED]: Use NLA_PUT_STRING for string dumping
[NET_SCHED]: Use nla_nest_start/nla_nest_end
[NET_SCHED]: Propagate nla_parse return value
[NET_SCHED]: act_api: use PTR_ERR in tcf_action_init/tcf_action_get
[NET_SCHED]: act_api: use nlmsg_parse
[NET_SCHED]: act_api: fix netlink API conversion bug
[NET_SCHED]: sch_netem: use nla_parse_nested_compat
[NET_SCHED]: sch_atm: fix format string warning
[NETNS]: Add namespace for ICMP replying code.
...
Diffstat (limited to 'include/linux/in.h')
-rw-r--r-- | include/linux/in.h | 68 |
1 files changed, 62 insertions, 6 deletions
diff --git a/include/linux/in.h b/include/linux/in.h index 3975cbf52f20..70c6df882694 100644 --- a/include/linux/in.h +++ b/include/linux/in.h | |||
@@ -246,13 +246,69 @@ struct sockaddr_in { | |||
246 | #include <asm/byteorder.h> | 246 | #include <asm/byteorder.h> |
247 | 247 | ||
248 | #ifdef __KERNEL__ | 248 | #ifdef __KERNEL__ |
249 | /* Some random defines to make it easier in the kernel.. */ | ||
250 | #define LOOPBACK(x) (((x) & htonl(0xff000000)) == htonl(0x7f000000)) | ||
251 | #define MULTICAST(x) (((x) & htonl(0xf0000000)) == htonl(0xe0000000)) | ||
252 | #define BADCLASS(x) (((x) & htonl(0xf0000000)) == htonl(0xf0000000)) | ||
253 | #define ZERONET(x) (((x) & htonl(0xff000000)) == htonl(0x00000000)) | ||
254 | #define LOCAL_MCAST(x) (((x) & htonl(0xFFFFFF00)) == htonl(0xE0000000)) | ||
255 | 249 | ||
250 | static inline bool ipv4_is_loopback(__be32 addr) | ||
251 | { | ||
252 | return (addr & htonl(0xff000000)) == htonl(0x7f000000); | ||
253 | } | ||
254 | |||
255 | static inline bool ipv4_is_multicast(__be32 addr) | ||
256 | { | ||
257 | return (addr & htonl(0xf0000000)) == htonl(0xe0000000); | ||
258 | } | ||
259 | |||
260 | static inline bool ipv4_is_local_multicast(__be32 addr) | ||
261 | { | ||
262 | return (addr & htonl(0xffffff00)) == htonl(0xe0000000); | ||
263 | } | ||
264 | |||
265 | static inline bool ipv4_is_lbcast(__be32 addr) | ||
266 | { | ||
267 | /* limited broadcast */ | ||
268 | return addr == INADDR_BROADCAST; | ||
269 | } | ||
270 | |||
271 | static inline bool ipv4_is_zeronet(__be32 addr) | ||
272 | { | ||
273 | return (addr & htonl(0xff000000)) == htonl(0x00000000); | ||
274 | } | ||
275 | |||
276 | /* Special-Use IPv4 Addresses (RFC3330) */ | ||
277 | |||
278 | static inline bool ipv4_is_private_10(__be32 addr) | ||
279 | { | ||
280 | return (addr & htonl(0xff000000)) == htonl(0x0a000000); | ||
281 | } | ||
282 | |||
283 | static inline bool ipv4_is_private_172(__be32 addr) | ||
284 | { | ||
285 | return (addr & htonl(0xfff00000)) == htonl(0xac100000); | ||
286 | } | ||
287 | |||
288 | static inline bool ipv4_is_private_192(__be32 addr) | ||
289 | { | ||
290 | return (addr & htonl(0xffff0000)) == htonl(0xc0a80000); | ||
291 | } | ||
292 | |||
293 | static inline bool ipv4_is_linklocal_169(__be32 addr) | ||
294 | { | ||
295 | return (addr & htonl(0xffff0000)) == htonl(0xa9fe0000); | ||
296 | } | ||
297 | |||
298 | static inline bool ipv4_is_anycast_6to4(__be32 addr) | ||
299 | { | ||
300 | return (addr & htonl(0xffffff00)) == htonl(0xc0586300); | ||
301 | } | ||
302 | |||
303 | static inline bool ipv4_is_test_192(__be32 addr) | ||
304 | { | ||
305 | return (addr & htonl(0xffffff00)) == htonl(0xc0000200); | ||
306 | } | ||
307 | |||
308 | static inline bool ipv4_is_test_198(__be32 addr) | ||
309 | { | ||
310 | return (addr & htonl(0xfffe0000)) == htonl(0xc6120000); | ||
311 | } | ||
256 | #endif | 312 | #endif |
257 | 313 | ||
258 | #endif /* _LINUX_IN_H */ | 314 | #endif /* _LINUX_IN_H */ |