From 01eb17a66dec4db6206fdba17b1dfed2f72f8ef3 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 15 Jul 2008 11:03:24 -0700 Subject: [PATCH 1/4] Update headers to 2.6.26 Copy santized version of headers from 2.6.26 final version. --- include/linux/netfilter_ipv4/ip_tables.h | 1 + include/linux/xfrm.h | 1 + 2 files changed, 2 insertions(+) diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h index fc64b97a..c42c73f7 100644 --- a/include/linux/netfilter_ipv4/ip_tables.h +++ b/include/linux/netfilter_ipv4/ip_tables.h @@ -15,6 +15,7 @@ #ifndef _IPTABLES_H #define _IPTABLES_H +#include #include #include diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index 132ba876..7af0aa43 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h @@ -339,6 +339,7 @@ struct xfrm_usersa_info { #define XFRM_STATE_NOPMTUDISC 4 #define XFRM_STATE_WILDRECV 8 #define XFRM_STATE_ICMP 16 +#define XFRM_STATE_AF_UNSPEC 32 }; struct xfrm_usersa_id { From 6579feeac4ccc0f087fa402486b3b2fcbcabc77f Mon Sep 17 00:00:00 2001 From: Varun Chandramohan Date: Mon, 2 Jun 2008 13:55:56 +0530 Subject: [PATCH 2/4] Display Correct Error For Addrlabel Info The command "ip addrlabel add/del" displays incorrect error message when provided with insufficient inputs. This patch fixes it in par with "ip addr add/del". Currently: # ./ip addrlabel add RTNETLINK answers: Numerical result out of range # ./ip addr add Not enough information: "dev" argument is required. After patch: # ./ip addrlabel add Not enough information: "prefix" argument is required. Signed-off-by: Varun Chandramohan Signed-off-by: Stephen Hemminger --- ip/ipaddrlabel.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ip/ipaddrlabel.c b/ip/ipaddrlabel.c index a4cdeceb..cf438d63 100644 --- a/ip/ipaddrlabel.c +++ b/ip/ipaddrlabel.c @@ -139,6 +139,8 @@ static int ipaddrlabel_modify(int cmd, int argc, char **argv) inet_prefix prefix; uint32_t label = 0xffffffffUL; + char *p = NULL; + char *l = NULL; memset(&req, 0, sizeof(req)); memset(&prefix, 0, sizeof(prefix)); @@ -157,6 +159,7 @@ static int ipaddrlabel_modify(int cmd, int argc, char **argv) while (argc > 0) { if (strcmp(*argv, "prefix") == 0) { NEXT_ARG(); + p = *argv; get_prefix(&prefix, *argv, preferred_family); } else if (strcmp(*argv, "dev") == 0) { NEXT_ARG(); @@ -164,13 +167,21 @@ static int ipaddrlabel_modify(int cmd, int argc, char **argv) invarg("dev is invalid\n", *argv); } else if (strcmp(*argv, "label") == 0) { NEXT_ARG(); + l = *argv; if (get_u32(&label, *argv, 0) || label == 0xffffffffUL) invarg("label is invalid\n", *argv); } argc--; argv++; } - + if (p == NULL) { + fprintf(stderr, "Not enough information: \"prefix\" argument is required.\n"); + return -1; + } + if (l == NULL) { + fprintf(stderr, "Not enough information: \"label\" argument is required.\n"); + return -1; + } addattr32(&req.n, sizeof(req), IFAL_LABEL, label); addattr_l(&req.n, sizeof(req), IFAL_ADDRESS, &prefix.data, prefix.bytelen); req.ifal.ifal_prefixlen = prefix.bitlen; From b514b3587ee56552fcc87a066c955a7ff4f55d6f Mon Sep 17 00:00:00 2001 From: Rafael Almeida Date: Sun, 1 Jun 2008 21:33:44 -0300 Subject: [PATCH 3/4] Fixed installation when changing DESTDIR After changing the DESTDIR the installated binaries have some issues due to hard coded paths. For example, using distributions on NetEm would segfault. I've changed iplink.c and tc_util.c so they are now aware of DESTDIR. Along with that change I needed to change the main Makefile so it defines the DESTDIR macro when calling gcc. I also changed the paths so that during the installation sbin, etc, share and lib directories are created directly inside of the DESTDIR, instead of creating a usr directory inside that. That's the behaviour of most packages out there, so I think most users will be expecting that to happen. --- Makefile | 10 +++++----- ip/iplink.c | 5 ++++- netem/Makefile | 4 ++-- tc/Makefile | 4 ++-- tc/tc_util.c | 6 +++++- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 723eb5d3..cfb27f42 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,13 @@ -DESTDIR= -SBINDIR=/usr/sbin +DESTDIR=/usr/ +SBINDIR=/sbin CONFDIR=/etc/iproute2 -DOCDIR=/usr/share/doc/iproute2 -MANDIR=/usr/share/man +DOCDIR=/share/doc/iproute2 +MANDIR=/share/man # Path to db_185.h include DBM_INCLUDE:=/usr/include -DEFINES= -DRESOLVE_HOSTNAMES +DEFINES= -DRESOLVE_HOSTNAMES -DDESTDIR=\"$(DESTDIR)\" #options if you have a bind>=4.9.4 libresolv (or, maybe, glibc) LDLIBS=-lresolv diff --git a/ip/iplink.c b/ip/iplink.c index c70c84ad..9a092630 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -33,6 +33,9 @@ #include "ip_common.h" #define IPLINK_IOCTL_COMPAT 1 +#ifndef DESTDIR +#define DESTDIR "/usr/" +#endif static void usage(void) __attribute__((noreturn)); @@ -78,7 +81,7 @@ struct link_util *get_link_kind(const char *id) if (strcmp(l->id, id) == 0) return l; - snprintf(buf, sizeof(buf), "/usr/lib/ip/link_%s.so", id); + snprintf(buf, sizeof(buf), DESTDIR "/lib/ip/link_%s.so", id); dlh = dlopen(buf, RTLD_LAZY); if (dlh == NULL) { /* look in current binary, only open once */ diff --git a/netem/Makefile b/netem/Makefile index 2d7d68bb..b6ccfc6a 100644 --- a/netem/Makefile +++ b/netem/Makefile @@ -20,9 +20,9 @@ stats: stats.c $(HOSTCC) $(CCOPTS) -I../include -o $@ $@.c -lm install: all - mkdir -p $(DESTDIR)/usr/lib/tc + mkdir -p $(DESTDIR)/lib/tc for i in $(DISTDATA); \ - do install -m 755 $$i $(DESTDIR)/usr/lib/tc; \ + do install -m 755 $$i $(DESTDIR)/lib/tc; \ done clean: diff --git a/tc/Makefile b/tc/Makefile index bf2df007..4116983e 100644 --- a/tc/Makefile +++ b/tc/Makefile @@ -72,10 +72,10 @@ libtc.a: $(TCLIB) $(AR) rcs $@ $(TCLIB) install: all - mkdir -p $(DESTDIR)/usr/lib/tc + mkdir -p $(DESTDIR)/lib/tc install -m 0755 tc $(DESTDIR)$(SBINDIR) for i in $(TCSO); \ - do install -m 755 $$i $(DESTDIR)/usr/lib/tc; \ + do install -m 755 $$i $(DESTDIR)/lib/tc; \ done clean: diff --git a/tc/tc_util.c b/tc/tc_util.c index cd9dd594..ba7c0c9d 100644 --- a/tc/tc_util.c +++ b/tc/tc_util.c @@ -24,13 +24,17 @@ #include "utils.h" #include "tc_util.h" +#ifndef DESTDIR +#define DESTDIR "/usr/" +#endif + const char *get_tc_lib(void) { const char *lib_dir; lib_dir = getenv("TC_LIB_DIR"); if (!lib_dir) - lib_dir = "/usr/lib/tc"; + lib_dir = DESTDIR "/lib/tc"; return lib_dir; } From 6420b62ec9f2f70f843dcb1892c27e18ebaf9564 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 25 Jul 2008 13:46:07 -0700 Subject: [PATCH 4/4] Update snapshot --- include/SNAPSHOT.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SNAPSHOT.h b/include/SNAPSHOT.h index 9d2637b1..a8a55462 100644 --- a/include/SNAPSHOT.h +++ b/include/SNAPSHOT.h @@ -1 +1 @@ -static const char SNAPSHOT[] = "080417"; +static const char SNAPSHOT[] = "080725";