[patch] Allow brctl to compile with kernels < 2.6.7
Wander Winkelhorst
w.winkelhorst at gmail.com
Fri Jan 30 13:24:11 UTC 2009
On Fri, Jan 30, 2009 at 1:56 PM, Timo Teräs <timo.teras at iki.fi> wrote:
> walter harms wrote:
>>
>>
>> #if LINUX_VERSION_CODE <KERNEL_VERSION(2,6,7)
>> #define CODE1 RCTL_ADD_BRIDGE: BRCTL_DEL_BRIDGE
>> #else
>> #define CODE1 SIOCBRADDBR : SIOCBRDELBR,
>> #endif
>>
>
> Why not just in the beginning:
>
> #if LINUX_VERSION_CODE < ...
> #define BRCTL_ADD_BRIDGE SIOCBRADDBR
> #define BRCTL_DEL_BRIDGE SIOCBRDELBR
> #endif
>
> ?
>
> - Timo
>
Good idea! And a good catch by Walter as well.
Here's an updated patch:
--- ./brctl.c.org 2009-01-30 13:08:28.000000000 +0100
+++ brctl.c 2009-01-30 14:21:42.000000000 +0100
@@ -15,4 +15,5 @@
#include "libbb.h"
#include <linux/sockios.h>
+#include <linux/version.h>
#include <net/if.h>
@@ -29,4 +30,12 @@
#include <linux/if_bridge.h>
+/* ioctl's got renamed in 2.6.7 */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7)
+#define SIOCBRADDBR BRCTL_ADD_BRIDGE
+#define SIOCBRDELBR BRCTL_DEL_BRIDGE
+#define SIOCBRADDIF BRCTL_ADD_IF
+#define SIOCBRDELIF BRCTL_DEL_IF
+#endif
+
/* FIXME: These 4 funcs are not really clean and could be improved */
static ALWAYS_INLINE void strtotimeval(struct timeval *tv,
More information about the busybox
mailing list