diff options
-rw-r--r-- | drivers/net/vxlan.c | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 6080f8e7b0cd..1c80b67c688d 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -144,52 +144,52 @@ static struct workqueue_struct *vxlan_wq; | |||
144 | static inline | 144 | static inline |
145 | bool vxlan_addr_equal(const union vxlan_addr *a, const union vxlan_addr *b) | 145 | bool vxlan_addr_equal(const union vxlan_addr *a, const union vxlan_addr *b) |
146 | { | 146 | { |
147 | if (a->sa.sa_family != b->sa.sa_family) | 147 | if (a->sa.sa_family != b->sa.sa_family) |
148 | return false; | 148 | return false; |
149 | if (a->sa.sa_family == AF_INET6) | 149 | if (a->sa.sa_family == AF_INET6) |
150 | return ipv6_addr_equal(&a->sin6.sin6_addr, &b->sin6.sin6_addr); | 150 | return ipv6_addr_equal(&a->sin6.sin6_addr, &b->sin6.sin6_addr); |
151 | else | 151 | else |
152 | return a->sin.sin_addr.s_addr == b->sin.sin_addr.s_addr; | 152 | return a->sin.sin_addr.s_addr == b->sin.sin_addr.s_addr; |
153 | } | 153 | } |
154 | 154 | ||
155 | static inline bool vxlan_addr_any(const union vxlan_addr *ipa) | 155 | static inline bool vxlan_addr_any(const union vxlan_addr *ipa) |
156 | { | 156 | { |
157 | if (ipa->sa.sa_family == AF_INET6) | 157 | if (ipa->sa.sa_family == AF_INET6) |
158 | return ipv6_addr_any(&ipa->sin6.sin6_addr); | 158 | return ipv6_addr_any(&ipa->sin6.sin6_addr); |
159 | else | 159 | else |
160 | return ipa->sin.sin_addr.s_addr == htonl(INADDR_ANY); | 160 | return ipa->sin.sin_addr.s_addr == htonl(INADDR_ANY); |
161 | } | 161 | } |
162 | 162 | ||
163 | static inline bool vxlan_addr_multicast(const union vxlan_addr *ipa) | 163 | static inline bool vxlan_addr_multicast(const union vxlan_addr *ipa) |
164 | { | 164 | { |
165 | if (ipa->sa.sa_family == AF_INET6) | 165 | if (ipa->sa.sa_family == AF_INET6) |
166 | return ipv6_addr_is_multicast(&ipa->sin6.sin6_addr); | 166 | return ipv6_addr_is_multicast(&ipa->sin6.sin6_addr); |
167 | else | 167 | else |
168 | return IN_MULTICAST(ntohl(ipa->sin.sin_addr.s_addr)); | 168 | return IN_MULTICAST(ntohl(ipa->sin.sin_addr.s_addr)); |
169 | } | 169 | } |
170 | 170 | ||
171 | static int vxlan_nla_get_addr(union vxlan_addr *ip, struct nlattr *nla) | 171 | static int vxlan_nla_get_addr(union vxlan_addr *ip, struct nlattr *nla) |
172 | { | 172 | { |
173 | if (nla_len(nla) >= sizeof(struct in6_addr)) { | 173 | if (nla_len(nla) >= sizeof(struct in6_addr)) { |
174 | nla_memcpy(&ip->sin6.sin6_addr, nla, sizeof(struct in6_addr)); | 174 | nla_memcpy(&ip->sin6.sin6_addr, nla, sizeof(struct in6_addr)); |
175 | ip->sa.sa_family = AF_INET6; | 175 | ip->sa.sa_family = AF_INET6; |
176 | return 0; | 176 | return 0; |
177 | } else if (nla_len(nla) >= sizeof(__be32)) { | 177 | } else if (nla_len(nla) >= sizeof(__be32)) { |
178 | ip->sin.sin_addr.s_addr = nla_get_be32(nla); | 178 | ip->sin.sin_addr.s_addr = nla_get_be32(nla); |
179 | ip->sa.sa_family = AF_INET; | 179 | ip->sa.sa_family = AF_INET; |
180 | return 0; | 180 | return 0; |
181 | } else { | 181 | } else { |
182 | return -EAFNOSUPPORT; | 182 | return -EAFNOSUPPORT; |
183 | } | 183 | } |
184 | } | 184 | } |
185 | 185 | ||
186 | static int vxlan_nla_put_addr(struct sk_buff *skb, int attr, | 186 | static int vxlan_nla_put_addr(struct sk_buff *skb, int attr, |
187 | const union vxlan_addr *ip) | 187 | const union vxlan_addr *ip) |
188 | { | 188 | { |
189 | if (ip->sa.sa_family == AF_INET6) | 189 | if (ip->sa.sa_family == AF_INET6) |
190 | return nla_put(skb, attr, sizeof(struct in6_addr), &ip->sin6.sin6_addr); | 190 | return nla_put(skb, attr, sizeof(struct in6_addr), &ip->sin6.sin6_addr); |
191 | else | 191 | else |
192 | return nla_put_be32(skb, attr, ip->sin.sin_addr.s_addr); | 192 | return nla_put_be32(skb, attr, ip->sin.sin_addr.s_addr); |
193 | } | 193 | } |
194 | 194 | ||
195 | #else /* !CONFIG_IPV6 */ | 195 | #else /* !CONFIG_IPV6 */ |
@@ -197,36 +197,36 @@ static int vxlan_nla_put_addr(struct sk_buff *skb, int attr, | |||
197 | static inline | 197 | static inline |
198 | bool vxlan_addr_equal(const union vxlan_addr *a, const union vxlan_addr *b) | 198 | bool vxlan_addr_equal(const union vxlan_addr *a, const union vxlan_addr *b) |
199 | { | 199 | { |
200 | return a->sin.sin_addr.s_addr == b->sin.sin_addr.s_addr; | 200 | return a->sin.sin_addr.s_addr == b->sin.sin_addr.s_addr; |
201 | } | 201 | } |
202 | 202 | ||
203 | static inline bool vxlan_addr_any(const union vxlan_addr *ipa) | 203 | static inline bool vxlan_addr_any(const union vxlan_addr *ipa) |
204 | { | 204 | { |
205 | return ipa->sin.sin_addr.s_addr == htonl(INADDR_ANY); | 205 | return ipa->sin.sin_addr.s_addr == htonl(INADDR_ANY); |
206 | } | 206 | } |
207 | 207 | ||
208 | static inline bool vxlan_addr_multicast(const union vxlan_addr *ipa) | 208 | static inline bool vxlan_addr_multicast(const union vxlan_addr *ipa) |
209 | { | 209 | { |
210 | return IN_MULTICAST(ntohl(ipa->sin.sin_addr.s_addr)); | 210 | return IN_MULTICAST(ntohl(ipa->sin.sin_addr.s_addr)); |
211 | } | 211 | } |
212 | 212 | ||
213 | static int vxlan_nla_get_addr(union vxlan_addr *ip, struct nlattr *nla) | 213 | static int vxlan_nla_get_addr(union vxlan_addr *ip, struct nlattr *nla) |
214 | { | 214 | { |
215 | if (nla_len(nla) >= sizeof(struct in6_addr)) { | 215 | if (nla_len(nla) >= sizeof(struct in6_addr)) { |
216 | return -EAFNOSUPPORT; | 216 | return -EAFNOSUPPORT; |
217 | } else if (nla_len(nla) >= sizeof(__be32)) { | 217 | } else if (nla_len(nla) >= sizeof(__be32)) { |
218 | ip->sin.sin_addr.s_addr = nla_get_be32(nla); | 218 | ip->sin.sin_addr.s_addr = nla_get_be32(nla); |
219 | ip->sa.sa_family = AF_INET; | 219 | ip->sa.sa_family = AF_INET; |
220 | return 0; | 220 | return 0; |
221 | } else { | 221 | } else { |
222 | return -EAFNOSUPPORT; | 222 | return -EAFNOSUPPORT; |
223 | } | 223 | } |
224 | } | 224 | } |
225 | 225 | ||
226 | static int vxlan_nla_put_addr(struct sk_buff *skb, int attr, | 226 | static int vxlan_nla_put_addr(struct sk_buff *skb, int attr, |
227 | const union vxlan_addr *ip) | 227 | const union vxlan_addr *ip) |
228 | { | 228 | { |
229 | return nla_put_be32(skb, attr, ip->sin.sin_addr.s_addr); | 229 | return nla_put_be32(skb, attr, ip->sin.sin_addr.s_addr); |
230 | } | 230 | } |
231 | #endif | 231 | #endif |
232 | 232 | ||