diff options
Diffstat (limited to 'include/net/ipv6.h')
-rw-r--r-- | include/net/ipv6.h | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 34200f9e6805..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 |
@@ -91,14 +89,12 @@ | |||
91 | /* | 89 | /* |
92 | * Addr flags | 90 | * Addr flags |
93 | */ | 91 | */ |
94 | #ifdef __KERNEL__ | ||
95 | #define IPV6_ADDR_MC_FLAG_TRANSIENT(a) \ | 92 | #define IPV6_ADDR_MC_FLAG_TRANSIENT(a) \ |
96 | ((a)->s6_addr[1] & 0x10) | 93 | ((a)->s6_addr[1] & 0x10) |
97 | #define IPV6_ADDR_MC_FLAG_PREFIX(a) \ | 94 | #define IPV6_ADDR_MC_FLAG_PREFIX(a) \ |
98 | ((a)->s6_addr[1] & 0x20) | 95 | ((a)->s6_addr[1] & 0x20) |
99 | #define IPV6_ADDR_MC_FLAG_RENDEZVOUS(a) \ | 96 | #define IPV6_ADDR_MC_FLAG_RENDEZVOUS(a) \ |
100 | ((a)->s6_addr[1] & 0x40) | 97 | ((a)->s6_addr[1] & 0x40) |
101 | #endif | ||
102 | 98 | ||
103 | /* | 99 | /* |
104 | * fragmentation header | 100 | * fragmentation header |
@@ -113,8 +109,6 @@ struct frag_hdr { | |||
113 | 109 | ||
114 | #define IP6_MF 0x0001 | 110 | #define IP6_MF 0x0001 |
115 | 111 | ||
116 | #ifdef __KERNEL__ | ||
117 | |||
118 | #include <net/sock.h> | 112 | #include <net/sock.h> |
119 | 113 | ||
120 | /* sysctls */ | 114 | /* sysctls */ |
@@ -129,6 +123,15 @@ extern struct ctl_path net_ipv6_ctl_path[]; | |||
129 | SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\ | 123 | SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\ |
130 | }) | 124 | }) |
131 | 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 | |||
132 | #define _DEVADD(net, statname, modifier, idev, field, val) \ | 135 | #define _DEVADD(net, statname, modifier, idev, field, val) \ |
133 | ({ \ | 136 | ({ \ |
134 | struct inet6_dev *_idev = (idev); \ | 137 | struct inet6_dev *_idev = (idev); \ |
@@ -160,16 +163,16 @@ extern struct ctl_path net_ipv6_ctl_path[]; | |||
160 | #define IP6_UPD_PO_STATS_BH(net, idev,field,val) \ | 163 | #define IP6_UPD_PO_STATS_BH(net, idev,field,val) \ |
161 | _DEVUPD(net, ipv6, 64_BH, idev, field, val) | 164 | _DEVUPD(net, ipv6, 64_BH, idev, field, val) |
162 | #define ICMP6_INC_STATS(net, idev, field) \ | 165 | #define ICMP6_INC_STATS(net, idev, field) \ |
163 | _DEVINC(net, icmpv6, , idev, field) | 166 | _DEVINCATOMIC(net, icmpv6, , idev, field) |
164 | #define ICMP6_INC_STATS_BH(net, idev, field) \ | 167 | #define ICMP6_INC_STATS_BH(net, idev, field) \ |
165 | _DEVINC(net, icmpv6, _BH, idev, field) | 168 | _DEVINCATOMIC(net, icmpv6, _BH, idev, field) |
166 | 169 | ||
167 | #define ICMP6MSGOUT_INC_STATS(net, idev, field) \ | 170 | #define ICMP6MSGOUT_INC_STATS(net, idev, field) \ |
168 | _DEVINC(net, icmpv6msg, , idev, field +256) | 171 | _DEVINCATOMIC(net, icmpv6msg, , idev, field +256) |
169 | #define ICMP6MSGOUT_INC_STATS_BH(net, idev, field) \ | 172 | #define ICMP6MSGOUT_INC_STATS_BH(net, idev, field) \ |
170 | _DEVINC(net, icmpv6msg, _BH, idev, field +256) | 173 | _DEVINCATOMIC(net, icmpv6msg, _BH, idev, field +256) |
171 | #define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \ | 174 | #define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \ |
172 | _DEVINC(net, icmpv6msg, _BH, idev, field) | 175 | _DEVINCATOMIC(net, icmpv6msg, _BH, idev, field) |
173 | 176 | ||
174 | struct ip6_ra_chain { | 177 | struct ip6_ra_chain { |
175 | struct ip6_ra_chain *next; | 178 | struct ip6_ra_chain *next; |
@@ -376,8 +379,8 @@ enum ip6_defrag_users { | |||
376 | struct ip6_create_arg { | 379 | struct ip6_create_arg { |
377 | __be32 id; | 380 | __be32 id; |
378 | u32 user; | 381 | u32 user; |
379 | struct in6_addr *src; | 382 | const struct in6_addr *src; |
380 | struct in6_addr *dst; | 383 | const struct in6_addr *dst; |
381 | }; | 384 | }; |
382 | 385 | ||
383 | void ip6_frag_init(struct inet_frag_queue *q, void *a); | 386 | void ip6_frag_init(struct inet_frag_queue *q, void *a); |
@@ -667,5 +670,4 @@ extern int ipv6_static_sysctl_register(void); | |||
667 | extern void ipv6_static_sysctl_unregister(void); | 670 | extern void ipv6_static_sysctl_unregister(void); |
668 | #endif | 671 | #endif |
669 | 672 | ||
670 | #endif /* __KERNEL__ */ | ||
671 | #endif /* _NET_IPV6_H */ | 673 | #endif /* _NET_IPV6_H */ |