Hi,
Attatched is a patch for the LOWER_UP flag in 'ip link/addr' output.
Useful to check if network cable is inserted or not.
The code does an ugly ifdef to check if IFF_LOWER_UP is declared or not.
On my zenwalk desktop it was not. It looks like iproute2 maintain their
own copies of the linux headers so I suppose we cannot expect the flag
be there. (should mabe be in one of the include files rather than in the
.c file?)
The patch does increase the size a bit due to a macro. Maybe should have
a config option for it?
on my hardened uclibc i386 build:
function old new delta
ipaddr_list_or_flush 2929 2981 +52
.rodata 7677 7683 +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 58/0) Total: 58
bytes
text data bss dec hex filename
47498 670 4244 52412 ccbc busybox_old
47556 670 4244 52470 ccf6 busybox_unstripped
-nc
Index: networking/libiproute/ipaddress.c
===================================================================
--- networking/libiproute/ipaddress.c (revision 22216)
+++ networking/libiproute/ipaddress.c (working copy)
@@ -18,6 +18,10 @@
#include "rt_names.h"
#include "utils.h"
+#ifndef IFF_LOWER_UP
+/* from linux/if.h */
+#define IFF_LOWER_UP 0x10000 /* driver signals L1 up*/
+#endif
typedef struct filter_t {
char *label;
@@ -63,6 +67,7 @@
_PF(NOTRAILERS);
#endif
_PF(UP);
+ _PF(LOWER_UP);
#undef _PF
if (flags)
fprintf(fp, "%x", flags);
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox