aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-10 10:56:55 -0400
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-24 21:24:01 -0400
commit1d5d236d309ab90fa6aedf712f586b3595721373 (patch)
tree983a6d65f59e8e4151ffbc6b60cd6275a5ec5c1d
parent6b75d0908185bf853b188afa6f269426f6554c5b (diff)
[IPV6]: Use bitfields for hop_limit and mcast_hops.
Save some bits for future extensions. Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
-rw-r--r--include/linux/ipv6.h28
1 files changed, 24 insertions, 4 deletions
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 9b59e37afad9..87ae4e389ce1 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -274,8 +274,29 @@ struct ipv6_pinfo {
274 274
275 __be32 flow_label; 275 __be32 flow_label;
276 __u32 frag_size; 276 __u32 frag_size;
277 __s16 hop_limit; 277
278 __s16 mcast_hops; 278 /*
279 * Packed in 16bits.
280 * Omit one shift by by putting the signed field at MSB.
281 */
282#if defined(__BIG_ENDIAN_BITFIELD)
283 __s16 hop_limit:9;
284 __u16 __unused_1:7;
285#else
286 __u16 __unused_1:7;
287 __s16 hop_limit:9;
288#endif
289
290#if defined(__BIG_ENDIAN_BITFIELD)
291 /* Packed in 16bits. */
292 __s16 mcast_hops:9;
293 __u16 __unused_2:6,
294 mc_loop:1;
295#else
296 __u16 mc_loop:1,
297 __unused_2:6;
298 __s16 mcast_hops:9;
299#endif
279 int mcast_oif; 300 int mcast_oif;
280 301
281 /* pktoption flags */ 302 /* pktoption flags */
@@ -298,8 +319,7 @@ struct ipv6_pinfo {
298 } rxopt; 319 } rxopt;
299 320
300 /* sockopt flags */ 321 /* sockopt flags */
301 __u8 mc_loop:1, 322 __u8 recverr:1,
302 recverr:1,
303 sndflow:1, 323 sndflow:1,
304 pmtudisc:2, 324 pmtudisc:2,
305 ipv6only:1; 325 ipv6only:1;