Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mcast: define and use MRT[6]_MAX in ip[6]_mroute_opt()

This will ease further addition of new MRT[6]_* values and avoid to update
in6.h each time.
Note that we reduce the maximum value from 210 to 209, but 210 does not match
any known value in ip[6]_mroute_setsockopt().

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: David L Stevens <dlstevens@us.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Nicolas Dichtel and committed by
David S. Miller
bbb923a4 202dc3fc

+8 -13
+1 -1
include/linux/mroute.h
··· 9 9 #ifdef CONFIG_IP_MROUTE 10 10 static inline int ip_mroute_opt(int opt) 11 11 { 12 - return (opt >= MRT_BASE) && (opt <= MRT_BASE + 10); 12 + return (opt >= MRT_BASE) && (opt <= MRT_MAX); 13 13 } 14 14 #else 15 15 static inline int ip_mroute_opt(int opt)
+1 -1
include/linux/mroute6.h
··· 10 10 #ifdef CONFIG_IPV6_MROUTE 11 11 static inline int ip6_mroute_opt(int opt) 12 12 { 13 - return (opt >= MRT6_BASE) && (opt <= MRT6_BASE + 10); 13 + return (opt >= MRT6_BASE) && (opt <= MRT6_MAX); 14 14 } 15 15 #else 16 16 static inline int ip6_mroute_opt(int opt)
+4 -11
include/uapi/linux/in6.h
··· 259 259 260 260 /* 261 261 * Multicast Routing: 262 - * see include/linux/mroute6.h. 262 + * see include/uapi/linux/mroute6.h. 263 263 * 264 - * MRT6_INIT 200 265 - * MRT6_DONE 201 266 - * MRT6_ADD_MIF 202 267 - * MRT6_DEL_MIF 203 268 - * MRT6_ADD_MFC 204 269 - * MRT6_DEL_MFC 205 270 - * MRT6_VERSION 206 271 - * MRT6_ASSERT 207 272 - * MRT6_PIM 208 273 - * (reserved) 209 264 + * MRT6_BASE 200 265 + * ... 266 + * MRT6_MAX 274 267 */ 275 268 #endif /* _UAPI_LINUX_IN6_H */
+1
include/uapi/linux/mroute.h
··· 26 26 #define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */ 27 27 #define MRT_PIM (MRT_BASE+8) /* enable PIM code */ 28 28 #define MRT_TABLE (MRT_BASE+9) /* Specify mroute table ID */ 29 + #define MRT_MAX (MRT_BASE+9) 29 30 30 31 #define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */ 31 32 #define SIOCGETSGCNT (SIOCPROTOPRIVATE+1)
+1
include/uapi/linux/mroute6.h
··· 26 26 #define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */ 27 27 #define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */ 28 28 #define MRT6_TABLE (MRT6_BASE+9) /* Specify mroute table ID */ 29 + #define MRT6_MAX (MRT6_BASE+9) 29 30 30 31 #define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */ 31 32 #define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1)