Support NETLINK_ADD_MEMBERSHIP even when compiled with old kernel headers.
authorBen Pfaff <blp@cs.stanford.edu>
Wed, 23 Apr 2008 21:25:27 +0000 (14:25 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 23 Apr 2008 21:25:27 +0000 (14:25 -0700)
commit15bf0e0b5d8a040953fca5f6b0c18c0630e9887f
treeb604f66a2d60953e6da2fd0cd4a4eb7c4b7d9560
parent800a8d91cb0d755a4c52ae1c74e37937ad2d77e0
Support NETLINK_ADD_MEMBERSHIP even when compiled with old kernel headers.

Commit 0a9024a2d7, "Changes based on feedback from GigaFin," added support
for compiling on a system that lacked up-to-date Linux kernel headers, by
dropping support for a feature only in newer kernels on such a system.
But the code already supported such a system properly; only the lack of
a macro definition kept it from compiling.  So define the macro ourselves
instead of disabling the feature.

To elaborate, there are two issues here.

The first is kernel support for NETLINK_ADD_MEMBERSHIP.  Older
kernels don't support this.  But NETLINK_ADD_MEMBERSHIP was added
at the same time as support for more than 32 netlink multicast
groups.  Netlink multicast groups numbered less than 32 can be
subscribed using a different mechanism, and in fact we do that
for such groups.  Thus, attempting to use NETLINK_ADD_MEMBERSHIP
on an older kernel basically can't happen, and if it did it would
be a bug in the OpenFlow kernel module for telling userspace to
subscribe to a multicast group that cannot exist on that kernel.

The second is the kernel headers that the userspace programs are
compiled with.  Without the change quoted below, the userspace
programs will silently fail if they are compiled with 2.4.x
headers and then run on a 2.6.x kernel and given a multicast
group numbered above 32, because they will not even try to
subscribe to that group.  With the change, the userspace programs
will work properly when run on 2.4.x or 2.6.x kernels regardless
of the multicast group number and regardless of whether the
headers they were compiled against were from 2.4.x or 2.6.x.
lib/netlink.c