diff options
| author | David S. Miller <davem@davemloft.net> | 2010-04-24 02:37:24 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2010-04-24 02:37:24 -0400 |
| commit | b7d6a4321195c32b548f0185a2fa0b8f6e02bcfc (patch) | |
| tree | 565faf60d0a2cf77f34275b77a775e3e4a5fb8d5 /include/net | |
| parent | 4b340ae20d0e2366792abe70f46629e576adaf5e (diff) | |
| parent | 08b202b6726459626c73ecfa08fcdc8c3efc76c2 (diff) | |
Merge branch 'net-next-2.6_20100423a/br/br_multicast_v3' of git://git.linux-ipv6.org/gitroot/yoshfuji/linux-2.6-next
Diffstat (limited to 'include/net')
| -rw-r--r-- | include/net/mld.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/include/net/mld.h b/include/net/mld.h new file mode 100644 index 000000000000..467143cd4e2f --- /dev/null +++ b/include/net/mld.h | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | #ifndef LINUX_MLD_H | ||
| 2 | #define LINUX_MLD_H | ||
| 3 | |||
| 4 | #include <linux/in6.h> | ||
| 5 | #include <linux/icmpv6.h> | ||
| 6 | |||
| 7 | /* MLDv1 Query/Report/Done */ | ||
| 8 | struct mld_msg { | ||
| 9 | struct icmp6hdr mld_hdr; | ||
| 10 | struct in6_addr mld_mca; | ||
| 11 | }; | ||
| 12 | |||
| 13 | #define mld_type mld_hdr.icmp6_type | ||
| 14 | #define mld_code mld_hdr.icmp6_code | ||
| 15 | #define mld_cksum mld_hdr.icmp6_cksum | ||
| 16 | #define mld_maxdelay mld_hdr.icmp6_maxdelay | ||
| 17 | #define mld_reserved mld_hdr.icmp6_dataun.un_data16[1] | ||
| 18 | |||
| 19 | /* Multicast Listener Discovery version 2 headers */ | ||
| 20 | /* MLDv2 Report */ | ||
| 21 | struct mld2_grec { | ||
| 22 | __u8 grec_type; | ||
| 23 | __u8 grec_auxwords; | ||
| 24 | __be16 grec_nsrcs; | ||
| 25 | struct in6_addr grec_mca; | ||
| 26 | struct in6_addr grec_src[0]; | ||
| 27 | }; | ||
| 28 | |||
| 29 | struct mld2_report { | ||
| 30 | struct icmp6hdr mld2r_hdr; | ||
| 31 | struct mld2_grec mld2r_grec[0]; | ||
| 32 | }; | ||
| 33 | |||
| 34 | #define mld2r_type mld2r_hdr.icmp6_type | ||
| 35 | #define mld2r_resv1 mld2r_hdr.icmp6_code | ||
| 36 | #define mld2r_cksum mld2r_hdr.icmp6_cksum | ||
| 37 | #define mld2r_resv2 mld2r_hdr.icmp6_dataun.un_data16[0] | ||
| 38 | #define mld2r_ngrec mld2r_hdr.icmp6_dataun.un_data16[1] | ||
| 39 | |||
| 40 | /* MLDv2 Query */ | ||
| 41 | struct mld2_query { | ||
| 42 | struct icmp6hdr mld2q_hdr; | ||
| 43 | struct in6_addr mld2q_mca; | ||
| 44 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
| 45 | __u8 mld2q_qrv:3, | ||
| 46 | mld2q_suppress:1, | ||
| 47 | mld2q_resv2:4; | ||
| 48 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
| 49 | __u8 mld2q_resv2:4, | ||
| 50 | mld2q_suppress:1, | ||
| 51 | mld2q_qrv:3; | ||
| 52 | #else | ||
| 53 | #error "Please fix <asm/byteorder.h>" | ||
| 54 | #endif | ||
| 55 | __u8 mld2q_qqic; | ||
| 56 | __be16 mld2q_nsrcs; | ||
| 57 | struct in6_addr mld2q_srcs[0]; | ||
| 58 | }; | ||
| 59 | |||
| 60 | #define mld2q_type mld2q_hdr.icmp6_type | ||
| 61 | #define mld2q_code mld2q_hdr.icmp6_code | ||
| 62 | #define mld2q_cksum mld2q_hdr.icmp6_cksum | ||
| 63 | #define mld2q_mrc mld2q_hdr.icmp6_maxdelay | ||
| 64 | #define mld2q_resv1 mld2q_hdr.icmp6_dataun.un_data16[1] | ||
| 65 | |||
| 66 | /* Max Response Code */ | ||
| 67 | #define MLDV2_MASK(value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value)) | ||
| 68 | #define MLDV2_EXP(thresh, nbmant, nbexp, value) \ | ||
| 69 | ((value) < (thresh) ? (value) : \ | ||
| 70 | ((MLDV2_MASK(value, nbmant) | (1<<(nbmant))) << \ | ||
| 71 | (MLDV2_MASK((value) >> (nbmant), nbexp) + (nbexp)))) | ||
| 72 | |||
| 73 | #define MLDV2_MRC(value) MLDV2_EXP(0x8000, 12, 3, value) | ||
| 74 | |||
| 75 | #endif | ||
