diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/net/ipv6.h | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'include/net/ipv6.h')
-rw-r--r-- | include/net/ipv6.h | 101 |
1 files changed, 59 insertions, 42 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 1f8412410998..c033ed00df7d 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -77,11 +77,9 @@ | |||
77 | /* | 77 | /* |
78 | * Addr scopes | 78 | * Addr scopes |
79 | */ | 79 | */ |
80 | #ifdef __KERNEL__ | ||
81 | #define IPV6_ADDR_MC_SCOPE(a) \ | 80 | #define IPV6_ADDR_MC_SCOPE(a) \ |
82 | ((a)->s6_addr[1] & 0x0f) /* nonstandard */ | 81 | ((a)->s6_addr[1] & 0x0f) /* nonstandard */ |
83 | #define __IPV6_ADDR_SCOPE_INVALID -1 | 82 | #define __IPV6_ADDR_SCOPE_INVALID -1 |
84 | #endif | ||
85 | #define IPV6_ADDR_SCOPE_NODELOCAL 0x01 | 83 | #define IPV6_ADDR_SCOPE_NODELOCAL 0x01 |
86 | #define IPV6_ADDR_SCOPE_LINKLOCAL 0x02 | 84 | #define IPV6_ADDR_SCOPE_LINKLOCAL 0x02 |
87 | #define IPV6_ADDR_SCOPE_SITELOCAL 0x05 | 85 | #define IPV6_ADDR_SCOPE_SITELOCAL 0x05 |
@@ -89,6 +87,16 @@ | |||
89 | #define IPV6_ADDR_SCOPE_GLOBAL 0x0e | 87 | #define IPV6_ADDR_SCOPE_GLOBAL 0x0e |
90 | 88 | ||
91 | /* | 89 | /* |
90 | * Addr flags | ||
91 | */ | ||
92 | #define IPV6_ADDR_MC_FLAG_TRANSIENT(a) \ | ||
93 | ((a)->s6_addr[1] & 0x10) | ||
94 | #define IPV6_ADDR_MC_FLAG_PREFIX(a) \ | ||
95 | ((a)->s6_addr[1] & 0x20) | ||
96 | #define IPV6_ADDR_MC_FLAG_RENDEZVOUS(a) \ | ||
97 | ((a)->s6_addr[1] & 0x40) | ||
98 | |||
99 | /* | ||
92 | * fragmentation header | 100 | * fragmentation header |
93 | */ | 101 | */ |
94 | 102 | ||
@@ -101,8 +109,6 @@ struct frag_hdr { | |||
101 | 109 | ||
102 | #define IP6_MF 0x0001 | 110 | #define IP6_MF 0x0001 |
103 | 111 | ||
104 | #ifdef __KERNEL__ | ||
105 | |||
106 | #include <net/sock.h> | 112 | #include <net/sock.h> |
107 | 113 | ||
108 | /* sysctls */ | 114 | /* sysctls */ |
@@ -117,6 +123,15 @@ extern struct ctl_path net_ipv6_ctl_path[]; | |||
117 | SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\ | 123 | SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\ |
118 | }) | 124 | }) |
119 | 125 | ||
126 | /* per device counters are atomic_long_t */ | ||
127 | #define _DEVINCATOMIC(net, statname, modifier, idev, field) \ | ||
128 | ({ \ | ||
129 | struct inet6_dev *_idev = (idev); \ | ||
130 | if (likely(_idev != NULL)) \ | ||
131 | SNMP_INC_STATS_ATOMIC_LONG((_idev)->stats.statname##dev, (field)); \ | ||
132 | SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\ | ||
133 | }) | ||
134 | |||
120 | #define _DEVADD(net, statname, modifier, idev, field, val) \ | 135 | #define _DEVADD(net, statname, modifier, idev, field, val) \ |
121 | ({ \ | 136 | ({ \ |
122 | struct inet6_dev *_idev = (idev); \ | 137 | struct inet6_dev *_idev = (idev); \ |
@@ -148,16 +163,16 @@ extern struct ctl_path net_ipv6_ctl_path[]; | |||
148 | #define IP6_UPD_PO_STATS_BH(net, idev,field,val) \ | 163 | #define IP6_UPD_PO_STATS_BH(net, idev,field,val) \ |
149 | _DEVUPD(net, ipv6, 64_BH, idev, field, val) | 164 | _DEVUPD(net, ipv6, 64_BH, idev, field, val) |
150 | #define ICMP6_INC_STATS(net, idev, field) \ | 165 | #define ICMP6_INC_STATS(net, idev, field) \ |
151 | _DEVINC(net, icmpv6, , idev, field) | 166 | _DEVINCATOMIC(net, icmpv6, , idev, field) |
152 | #define ICMP6_INC_STATS_BH(net, idev, field) \ | 167 | #define ICMP6_INC_STATS_BH(net, idev, field) \ |
153 | _DEVINC(net, icmpv6, _BH, idev, field) | 168 | _DEVINCATOMIC(net, icmpv6, _BH, idev, field) |
154 | 169 | ||
155 | #define ICMP6MSGOUT_INC_STATS(net, idev, field) \ | 170 | #define ICMP6MSGOUT_INC_STATS(net, idev, field) \ |
156 | _DEVINC(net, icmpv6msg, , idev, field +256) | 171 | _DEVINCATOMIC(net, icmpv6msg, , idev, field +256) |
157 | #define ICMP6MSGOUT_INC_STATS_BH(net, idev, field) \ | 172 | #define ICMP6MSGOUT_INC_STATS_BH(net, idev, field) \ |
158 | _DEVINC(net, icmpv6msg, _BH, idev, field +256) | 173 | _DEVINCATOMIC(net, icmpv6msg, _BH, idev, field +256) |
159 | #define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \ | 174 | #define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \ |
160 | _DEVINC(net, icmpv6msg, _BH, idev, field) | 175 | _DEVINCATOMIC(net, icmpv6msg, _BH, idev, field) |
161 | 176 | ||
162 | struct ip6_ra_chain { | 177 | struct ip6_ra_chain { |
163 | struct ip6_ra_chain *next; | 178 | struct ip6_ra_chain *next; |
@@ -262,7 +277,7 @@ static inline int ipv6_addr_scope(const struct in6_addr *addr) | |||
262 | 277 | ||
263 | static inline int __ipv6_addr_src_scope(int type) | 278 | static inline int __ipv6_addr_src_scope(int type) |
264 | { | 279 | { |
265 | return (type == IPV6_ADDR_ANY ? __IPV6_ADDR_SCOPE_INVALID : (type >> 16)); | 280 | return (type == IPV6_ADDR_ANY) ? __IPV6_ADDR_SCOPE_INVALID : (type >> 16); |
266 | } | 281 | } |
267 | 282 | ||
268 | static inline int ipv6_addr_src_scope(const struct in6_addr *addr) | 283 | static inline int ipv6_addr_src_scope(const struct in6_addr *addr) |
@@ -279,10 +294,10 @@ static inline int | |||
279 | ipv6_masked_addr_cmp(const struct in6_addr *a1, const struct in6_addr *m, | 294 | ipv6_masked_addr_cmp(const struct in6_addr *a1, const struct in6_addr *m, |
280 | const struct in6_addr *a2) | 295 | const struct in6_addr *a2) |
281 | { | 296 | { |
282 | return (!!(((a1->s6_addr32[0] ^ a2->s6_addr32[0]) & m->s6_addr32[0]) | | 297 | return !!(((a1->s6_addr32[0] ^ a2->s6_addr32[0]) & m->s6_addr32[0]) | |
283 | ((a1->s6_addr32[1] ^ a2->s6_addr32[1]) & m->s6_addr32[1]) | | 298 | ((a1->s6_addr32[1] ^ a2->s6_addr32[1]) & m->s6_addr32[1]) | |
284 | ((a1->s6_addr32[2] ^ a2->s6_addr32[2]) & m->s6_addr32[2]) | | 299 | ((a1->s6_addr32[2] ^ a2->s6_addr32[2]) & m->s6_addr32[2]) | |
285 | ((a1->s6_addr32[3] ^ a2->s6_addr32[3]) & m->s6_addr32[3]))); | 300 | ((a1->s6_addr32[3] ^ a2->s6_addr32[3]) & m->s6_addr32[3])); |
286 | } | 301 | } |
287 | 302 | ||
288 | static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2) | 303 | static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2) |
@@ -317,10 +332,10 @@ static inline void ipv6_addr_set(struct in6_addr *addr, | |||
317 | static inline int ipv6_addr_equal(const struct in6_addr *a1, | 332 | static inline int ipv6_addr_equal(const struct in6_addr *a1, |
318 | const struct in6_addr *a2) | 333 | const struct in6_addr *a2) |
319 | { | 334 | { |
320 | return (((a1->s6_addr32[0] ^ a2->s6_addr32[0]) | | 335 | return ((a1->s6_addr32[0] ^ a2->s6_addr32[0]) | |
321 | (a1->s6_addr32[1] ^ a2->s6_addr32[1]) | | 336 | (a1->s6_addr32[1] ^ a2->s6_addr32[1]) | |
322 | (a1->s6_addr32[2] ^ a2->s6_addr32[2]) | | 337 | (a1->s6_addr32[2] ^ a2->s6_addr32[2]) | |
323 | (a1->s6_addr32[3] ^ a2->s6_addr32[3])) == 0); | 338 | (a1->s6_addr32[3] ^ a2->s6_addr32[3])) == 0; |
324 | } | 339 | } |
325 | 340 | ||
326 | static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2, | 341 | static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2, |
@@ -364,8 +379,8 @@ enum ip6_defrag_users { | |||
364 | struct ip6_create_arg { | 379 | struct ip6_create_arg { |
365 | __be32 id; | 380 | __be32 id; |
366 | u32 user; | 381 | u32 user; |
367 | struct in6_addr *src; | 382 | const struct in6_addr *src; |
368 | struct in6_addr *dst; | 383 | const struct in6_addr *dst; |
369 | }; | 384 | }; |
370 | 385 | ||
371 | void ip6_frag_init(struct inet_frag_queue *q, void *a); | 386 | void ip6_frag_init(struct inet_frag_queue *q, void *a); |
@@ -373,20 +388,20 @@ int ip6_frag_match(struct inet_frag_queue *q, void *a); | |||
373 | 388 | ||
374 | static inline int ipv6_addr_any(const struct in6_addr *a) | 389 | static inline int ipv6_addr_any(const struct in6_addr *a) |
375 | { | 390 | { |
376 | return ((a->s6_addr32[0] | a->s6_addr32[1] | | 391 | return (a->s6_addr32[0] | a->s6_addr32[1] | |
377 | a->s6_addr32[2] | a->s6_addr32[3] ) == 0); | 392 | a->s6_addr32[2] | a->s6_addr32[3]) == 0; |
378 | } | 393 | } |
379 | 394 | ||
380 | static inline int ipv6_addr_loopback(const struct in6_addr *a) | 395 | static inline int ipv6_addr_loopback(const struct in6_addr *a) |
381 | { | 396 | { |
382 | return ((a->s6_addr32[0] | a->s6_addr32[1] | | 397 | return (a->s6_addr32[0] | a->s6_addr32[1] | |
383 | a->s6_addr32[2] | (a->s6_addr32[3] ^ htonl(1))) == 0); | 398 | a->s6_addr32[2] | (a->s6_addr32[3] ^ htonl(1))) == 0; |
384 | } | 399 | } |
385 | 400 | ||
386 | static inline int ipv6_addr_v4mapped(const struct in6_addr *a) | 401 | static inline int ipv6_addr_v4mapped(const struct in6_addr *a) |
387 | { | 402 | { |
388 | return ((a->s6_addr32[0] | a->s6_addr32[1] | | 403 | return (a->s6_addr32[0] | a->s6_addr32[1] | |
389 | (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0); | 404 | (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0; |
390 | } | 405 | } |
391 | 406 | ||
392 | /* | 407 | /* |
@@ -395,8 +410,7 @@ static inline int ipv6_addr_v4mapped(const struct in6_addr *a) | |||
395 | */ | 410 | */ |
396 | static inline int ipv6_addr_orchid(const struct in6_addr *a) | 411 | static inline int ipv6_addr_orchid(const struct in6_addr *a) |
397 | { | 412 | { |
398 | return ((a->s6_addr32[0] & htonl(0xfffffff0)) | 413 | return (a->s6_addr32[0] & htonl(0xfffffff0)) == htonl(0x20010010); |
399 | == htonl(0x20010010)); | ||
400 | } | 414 | } |
401 | 415 | ||
402 | static inline void ipv6_addr_set_v4mapped(const __be32 addr, | 416 | static inline void ipv6_addr_set_v4mapped(const __be32 addr, |
@@ -441,7 +455,7 @@ static inline int __ipv6_addr_diff(const void *token1, const void *token2, int a | |||
441 | * if returned value is greater than prefix length. | 455 | * if returned value is greater than prefix length. |
442 | * --ANK (980803) | 456 | * --ANK (980803) |
443 | */ | 457 | */ |
444 | return (addrlen << 5); | 458 | return addrlen << 5; |
445 | } | 459 | } |
446 | 460 | ||
447 | static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_addr *a2) | 461 | static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_addr *a2) |
@@ -481,7 +495,7 @@ extern int ip6_rcv_finish(struct sk_buff *skb); | |||
481 | */ | 495 | */ |
482 | extern int ip6_xmit(struct sock *sk, | 496 | extern int ip6_xmit(struct sock *sk, |
483 | struct sk_buff *skb, | 497 | struct sk_buff *skb, |
484 | struct flowi *fl, | 498 | struct flowi6 *fl6, |
485 | struct ipv6_txoptions *opt); | 499 | struct ipv6_txoptions *opt); |
486 | 500 | ||
487 | extern int ip6_nd_hdr(struct sock *sk, | 501 | extern int ip6_nd_hdr(struct sock *sk, |
@@ -501,7 +515,7 @@ extern int ip6_append_data(struct sock *sk, | |||
501 | int hlimit, | 515 | int hlimit, |
502 | int tclass, | 516 | int tclass, |
503 | struct ipv6_txoptions *opt, | 517 | struct ipv6_txoptions *opt, |
504 | struct flowi *fl, | 518 | struct flowi6 *fl6, |
505 | struct rt6_info *rt, | 519 | struct rt6_info *rt, |
506 | unsigned int flags, | 520 | unsigned int flags, |
507 | int dontfrag); | 521 | int dontfrag); |
@@ -512,13 +526,17 @@ extern void ip6_flush_pending_frames(struct sock *sk); | |||
512 | 526 | ||
513 | extern int ip6_dst_lookup(struct sock *sk, | 527 | extern int ip6_dst_lookup(struct sock *sk, |
514 | struct dst_entry **dst, | 528 | struct dst_entry **dst, |
515 | struct flowi *fl); | 529 | struct flowi6 *fl6); |
516 | extern int ip6_dst_blackhole(struct sock *sk, | 530 | extern struct dst_entry * ip6_dst_lookup_flow(struct sock *sk, |
517 | struct dst_entry **dst, | 531 | struct flowi6 *fl6, |
518 | struct flowi *fl); | 532 | const struct in6_addr *final_dst, |
519 | extern int ip6_sk_dst_lookup(struct sock *sk, | 533 | bool can_sleep); |
520 | struct dst_entry **dst, | 534 | extern struct dst_entry * ip6_sk_dst_lookup_flow(struct sock *sk, |
521 | struct flowi *fl); | 535 | struct flowi6 *fl6, |
536 | const struct in6_addr *final_dst, | ||
537 | bool can_sleep); | ||
538 | extern struct dst_entry * ip6_blackhole_route(struct net *net, | ||
539 | struct dst_entry *orig_dst); | ||
522 | 540 | ||
523 | /* | 541 | /* |
524 | * skb processing functions | 542 | * skb processing functions |
@@ -551,7 +569,7 @@ extern int ipv6_ext_hdr(u8 nexthdr); | |||
551 | 569 | ||
552 | extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); | 570 | extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); |
553 | 571 | ||
554 | extern struct in6_addr *fl6_update_dst(struct flowi *fl, | 572 | extern struct in6_addr *fl6_update_dst(struct flowi6 *fl6, |
555 | const struct ipv6_txoptions *opt, | 573 | const struct ipv6_txoptions *opt, |
556 | struct in6_addr *orig); | 574 | struct in6_addr *orig); |
557 | 575 | ||
@@ -585,8 +603,8 @@ extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len); | |||
585 | extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len); | 603 | extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len); |
586 | extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, | 604 | extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, |
587 | u32 info, u8 *payload); | 605 | u32 info, u8 *payload); |
588 | extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info); | 606 | extern void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info); |
589 | extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi *fl, u32 mtu); | 607 | extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu); |
590 | 608 | ||
591 | extern int inet6_release(struct socket *sock); | 609 | extern int inet6_release(struct socket *sock); |
592 | extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr, | 610 | extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr, |
@@ -652,5 +670,4 @@ extern int ipv6_static_sysctl_register(void); | |||
652 | extern void ipv6_static_sysctl_unregister(void); | 670 | extern void ipv6_static_sysctl_unregister(void); |
653 | #endif | 671 | #endif |
654 | 672 | ||
655 | #endif /* __KERNEL__ */ | ||
656 | #endif /* _NET_IPV6_H */ | 673 | #endif /* _NET_IPV6_H */ |