nl_mgrp to crap if base multicast groups exceeded

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>
This commit is contained in:
jamal 2007-02-25 12:02:23 -05:00 committed by Stephen Hemminger
parent b64f58b013
commit 56b9406191
1 changed files with 6 additions and 1 deletions

View 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;
}