diff options
Diffstat (limited to 'include/net/if_inet6.h')
-rw-r--r-- | include/net/if_inet6.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h index 04977eefb0ee..fccc2180c61b 100644 --- a/include/net/if_inet6.h +++ b/include/net/if_inet6.h | |||
@@ -286,5 +286,21 @@ static inline void ipv6_ib_mc_map(const struct in6_addr *addr, | |||
286 | buf[9] = broadcast[9]; | 286 | buf[9] = broadcast[9]; |
287 | memcpy(buf + 10, addr->s6_addr + 6, 10); | 287 | memcpy(buf + 10, addr->s6_addr + 6, 10); |
288 | } | 288 | } |
289 | |||
290 | static inline int ipv6_ipgre_mc_map(const struct in6_addr *addr, | ||
291 | const unsigned char *broadcast, char *buf) | ||
292 | { | ||
293 | if ((broadcast[0] | broadcast[1] | broadcast[2] | broadcast[3]) != 0) { | ||
294 | memcpy(buf, broadcast, 4); | ||
295 | } else { | ||
296 | /* v4mapped? */ | ||
297 | if ((addr->s6_addr32[0] | addr->s6_addr32[1] | | ||
298 | (addr->s6_addr32[2] ^ htonl(0x0000ffff))) != 0) | ||
299 | return -EINVAL; | ||
300 | memcpy(buf, &addr->s6_addr32[3], 4); | ||
301 | } | ||
302 | return 0; | ||
303 | } | ||
304 | |||
289 | #endif | 305 | #endif |
290 | #endif | 306 | #endif |