Skip to contentSkip to conversation

nl_mgrp to crap if base multicast groups exceeded

IPROUTE2 jamal 2 participants 2 messages Feb 25, 2007 – Mar 13, 2007

Subsystems (2)
lore
Share & tools
lore

jamal

author
#0 lore raw

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.

---
commit f3d272cea2870805677809bf121737fb6c36dc8e
tree b1e42d5c8d9122a600f2f81e04b0d197642b1878
parent 539bc1cc1b002700504ad8cbe82ea451026c5fe4
author Jamal Hadi Salim <[email protected]> Sun, 25 Feb 2007 11:50:53 -0500 committer Jamal Hadi Salim <[email protected]> Sun, 25 Feb 2007 11:50:53 -0500

 include/utils.h |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
include/utils.h +6 -1
index 1769ca1..a3fd335 100644
@@ -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;
 }