diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/in.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/in.h b/include/linux/in.h index 41d88a4689af..beeb6dee2b49 100644 --- a/include/linux/in.h +++ b/include/linux/in.h | |||
@@ -250,6 +250,25 @@ struct sockaddr_in { | |||
250 | 250 | ||
251 | #ifdef __KERNEL__ | 251 | #ifdef __KERNEL__ |
252 | 252 | ||
253 | #include <linux/errno.h> | ||
254 | |||
255 | static inline int proto_ports_offset(int proto) | ||
256 | { | ||
257 | switch (proto) { | ||
258 | case IPPROTO_TCP: | ||
259 | case IPPROTO_UDP: | ||
260 | case IPPROTO_DCCP: | ||
261 | case IPPROTO_ESP: /* SPI */ | ||
262 | case IPPROTO_SCTP: | ||
263 | case IPPROTO_UDPLITE: | ||
264 | return 0; | ||
265 | case IPPROTO_AH: /* SPI */ | ||
266 | return 4; | ||
267 | default: | ||
268 | return -EINVAL; | ||
269 | } | ||
270 | } | ||
271 | |||
253 | static inline bool ipv4_is_loopback(__be32 addr) | 272 | static inline bool ipv4_is_loopback(__be32 addr) |
254 | { | 273 | { |
255 | return (addr & htonl(0xff000000)) == htonl(0x7f000000); | 274 | return (addr & htonl(0xff000000)) == htonl(0x7f000000); |