Resend: [PATCH] Fix libiproute build with kernel headers older than 2.6.17

Stefan Seyfried stefan.seyfried at googlemail.com
Sat Feb 26 10:52:25 UTC 2011


On Mon, 21 Feb 2011 17:45:49 +0100
Stefan Seyfried <stefan.seyfried at googlemail.com> wrote:

> Hi,
> 
> the attached patch fixes the build if your kernel headers happen to be
> older than 2.6.17, which is when IFLA_OPERSTATE was introduced.
> 
> Unfortunately, IFLA_OPERSTATE is not a define, so I can't check it with
> #ifdef. However, IFF_DORMANT is a define and was introduced with the very
> same commit, so we might be safe.
> 
> A comment explaining this situation is in place.

From cda685fa074ffbd324d752c11de596db8ffbbe64 Mon Sep 17 00:00:00 2001
From: Stefan Seyfried <seife+dev at b1-systems.com>
Date: Mon, 21 Feb 2011 17:29:59 +0100
Subject: [PATCH] fix libiproute compile with kernel headers < 2.6.17

Signed-off-by: Stefan Seyfried <seife+dev at b1-systems.com>
---
 networking/libiproute/ipaddress.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c
index 397a8ee..e4f9070 100644
--- a/networking/libiproute/ipaddress.c
+++ b/networking/libiproute/ipaddress.c
@@ -162,6 +162,8 @@ static NOINLINE int print_linkinfo(const struct nlmsghdr *n)
 		printf("master %s ", ll_idx_n2a(*(int*)RTA_DATA(tb[IFLA_MASTER]), b1));
 	}
 #endif
+/* IFLA_OPERSTATE came with the same commit as IFF_DORMANT */
+#ifdef IFF_DORMANT
 	if (tb[IFLA_OPERSTATE]) {
 		static const char operstate_labels[] ALIGN1 =
 			"UNKNOWN\0""NOTPRESENT\0""DOWN\0""LOWERLAYERDOWN\0"
@@ -169,6 +171,7 @@ static NOINLINE int print_linkinfo(const struct nlmsghdr *n)
 		printf("state %s ", nth_string(operstate_labels,
 					*(uint8_t *)RTA_DATA(tb[IFLA_OPERSTATE])));
 	}
+#endif
 	if (G_filter.showqueue)
 		print_queuelen((char*)RTA_DATA(tb[IFLA_IFNAME]));
 
-- 
1.7.3.4


-- 
Stefan Seyfried

"Dispatch war rocket Ajax to bring back his body!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fix-libiproute-compile-with-kernel-headers-2.6.17.patch
Type: text/x-patch
Size: 1254 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20110226/a6c15659/attachment.bin>


More information about the busybox mailing list