]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
nl_mgrp to crap if base multicast groups exceeded
authorjamal <hadi@cyberus.ca>
Sun, 25 Feb 2007 17:02:23 +0000 (12:02 -0500)
committerStephen Hemminger <shemminger@linux-foundation.org>
Tue, 13 Mar 2007 21:39:37 +0000 (14:39 -0700)
cheers,
jamal

[GENERAL] nl_mgrp to crap if base multicast groups exceeded

The old scheme of bitmasks works only for the first 32 groups.
Above that the setsockopt scheme must be used.

Signed-off-by: J Hadi Salim <hadi@cyberus.ca>
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
include/utils.h

index 1769ca101c145ec6a6bda8550911da497c05636d..a3fd3356eceb91faadffed11dd4350fcc439c022 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <asm/types.h>
 #include <resolv.h>
+#include <stdlib.h>
 
 #include "libnetlink.h"
 #include "ll_map.h"
@@ -129,7 +130,11 @@ static __inline__ int get_user_hz(void)
 
 static inline __u32 nl_mgrp(__u32 group)
 {
-       return group ? (1 << (group -1)) : 0;
+       if (group > 31 ) {
+               fprintf(stderr, "Use setsockopt for this group %d\n", group);
+               exit(-1);
+       }
+       return group ? (1 << (group - 1)) : 0;
 }