* [PATCH 2/3] compat: fix iteration over destination multicast addresses
2011-08-03 5:03 [PATCH 1/3] compat: remove stray #endif from compat-2.6.23.c Pavel Roskin
@ 2011-08-03 5:03 ` Pavel Roskin
2011-08-03 5:03 ` [PATCH 3/3] compat: don't define genl_register_mc_group() for Linux 2.6.22 and older Pavel Roskin
1 sibling, 0 replies; 3+ messages in thread
From: Pavel Roskin @ 2011-08-03 5:03 UTC (permalink / raw)
To: Luis R. Rodriguez, linux-wireless
Fix dev_mc_sync() and dev_mc_unsync() in compat-2.6.23.c. When looking
for synchronized addresses, put "break" inside the above "if" to break
the loop only if there is a match. Otherwise, advance da_to to the next
address.
Signed-off-by: Pavel Roskin <proski@gnu.org>
---
compat/compat-2.6.23.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/compat/compat-2.6.23.c b/compat/compat-2.6.23.c
index d31cfb4..365f941 100644
--- a/compat/compat-2.6.23.c
+++ b/compat/compat-2.6.23.c
@@ -104,9 +104,11 @@ int dev_mc_sync(struct net_device *to, struct net_device *from)
/* 2.6.22 does not have da->da_synced so lets take the long route */
while (da_to != NULL) {
if (memcmp(da_to->da_addr, da->da_addr, da_to->da_addrlen) == 0 &&
- da->da_addrlen == da_to->da_addrlen)
+ da->da_addrlen == da_to->da_addrlen) {
synced = 1;
break;
+ }
+ da_to = da_to->next;
}
if (!synced) {
err = __dev_addr_add(&to->mc_list, &to->mc_count,
@@ -160,9 +162,11 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from)
/* 2.6.22 does not have da->da_synced so lets take the long route */
while (da_to != NULL) {
if (memcmp(da_to->da_addr, da->da_addr, da_to->da_addrlen) == 0 &&
- da->da_addrlen == da_to->da_addrlen)
+ da->da_addrlen == da_to->da_addrlen) {
synced = true;
break;
+ }
+ da_to = da_to->next;
}
if (!synced) {
da = next;
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 3/3] compat: don't define genl_register_mc_group() for Linux 2.6.22 and older
2011-08-03 5:03 [PATCH 1/3] compat: remove stray #endif from compat-2.6.23.c Pavel Roskin
2011-08-03 5:03 ` [PATCH 2/3] compat: fix iteration over destination multicast addresses Pavel Roskin
@ 2011-08-03 5:03 ` Pavel Roskin
1 sibling, 0 replies; 3+ messages in thread
From: Pavel Roskin @ 2011-08-03 5:03 UTC (permalink / raw)
To: Luis R. Rodriguez, linux-wireless
compat-2.6.23.h has a different definition of genl_register_mc_group().
Likewise, don't define genl_unregister_mc_group() for old kernels.
Signed-off-by: Pavel Roskin <proski@gnu.org>
---
include/linux/compat-2.6.37.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.37.h b/include/linux/compat-2.6.37.h
index d375746..78b0b38 100644
--- a/include/linux/compat-2.6.37.h
+++ b/include/linux/compat-2.6.37.h
@@ -91,8 +91,11 @@ int genl_unregister_family(struct genl_family *family);
#define genlmsg_reply(_msg, _info) genlmsg_reply(_msg, (_info)->info)
#define genlmsg_put(_skb, _pid, _seq, _fam, _flags, _cmd) genlmsg_put(_skb, _pid, _seq, &(_fam)->family, _flags, _cmd)
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
#define genl_register_mc_group(_fam, _grp) genl_register_mc_group(&(_fam)->family, _grp)
#define genl_unregister_mc_group(_fam, _grp) genl_unregister_mc_group(&(_fam)->family, _grp)
+#endif
extern void led_blink_set(struct led_classdev *led_cdev,
^ permalink raw reply related [flat|nested] 3+ messages in thread