ovsdb: Synchronize comments and code in ovsdb_file_commit().
[sliver-openvswitch.git] / datapath / linux / compat / include / linux / in.h
1 #ifndef __LINUX_IN_WRAPPER_H
2 #define __LINUX_IN_WRAPPER_H 1
3
4 #include_next <linux/in.h>
5
6 #ifndef HAVE_IPV4_IS_MULTICAST
7
8 static inline bool ipv4_is_loopback(__be32 addr)
9 {
10         return (addr & htonl(0xff000000)) == htonl(0x7f000000);
11 }
12
13 static inline bool ipv4_is_multicast(__be32 addr)
14 {
15         return (addr & htonl(0xf0000000)) == htonl(0xe0000000);
16 }
17
18 static inline bool ipv4_is_local_multicast(__be32 addr)
19 {
20         return (addr & htonl(0xffffff00)) == htonl(0xe0000000);
21 }
22
23 static inline bool ipv4_is_lbcast(__be32 addr)
24 {
25         /* limited broadcast */
26         return addr == htonl(INADDR_BROADCAST);
27 }
28
29 static inline bool ipv4_is_zeronet(__be32 addr)
30 {
31         return (addr & htonl(0xff000000)) == htonl(0x00000000);
32 }
33
34 #endif /* !HAVE_IPV4_IS_MULTICAST */
35
36 #endif