* iproute2 update @ 2006-12-05 18:17 Stephen Hemminger 2006-12-05 18:43 ` Patrick McHardy 2006-12-06 3:58 ` Masahide NAKAMURA 0 siblings, 2 replies; 16+ messages in thread From: Stephen Hemminger @ 2006-12-05 18:17 UTC (permalink / raw) To: Jamal, Masahide NAKAMURA, Thomas Graf; +Cc: netdev I am about to push out a new version, so if you have any more patches pending the window is about to close. Please retest with current git tree -- Stephen Hemminger <shemminger@osdl.org> ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: iproute2 update 2006-12-05 18:17 iproute2 update Stephen Hemminger @ 2006-12-05 18:43 ` Patrick McHardy 2006-12-06 3:58 ` Masahide NAKAMURA 1 sibling, 0 replies; 16+ messages in thread From: Patrick McHardy @ 2006-12-05 18:43 UTC (permalink / raw) To: Stephen Hemminger; +Cc: Jamal, Masahide NAKAMURA, Thomas Graf, netdev [-- Attachment #1: Type: text/plain, Size: 185 bytes --] Stephen Hemminger wrote: > I am about to push out a new version, so if you have any more patches pending > the window is about to close. I still have this one I would like to get in. [-- Attachment #2: x --] [-- Type: text/plain, Size: 3204 bytes --] [IPROUTE]: Add support for routing rule fwmark masks Needs kernel >= 2.6.19. Signed-off-by: Patrick McHardy <kaber@trash.net> --- commit ba3145833888823f1e1af4ef093d16eea9baed2c tree 23ef86c81e53c94d3f8d67d5395bcc3183d39e4b parent 288384f22ffafd2d7d888ee45d8dfcf26d3f2b1c author Patrick McHardy <kaber@trash.net> Tue, 05 Dec 2006 19:41:36 +0100 committer Patrick McHardy <kaber@trash.net> Tue, 05 Dec 2006 19:41:36 +0100 include/linux/rtnetlink.h | 1 + ip/iprule.c | 25 +++++++++++++++++++++---- man/man8/ip.8 | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 1ee3a56..c02470c 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h @@ -264,6 +264,7 @@ enum rtattr_type_t RTA_SESSION, RTA_MP_ALGO, RTA_TABLE, + RTA_FWMASK, __RTA_MAX }; diff --git a/ip/iprule.c b/ip/iprule.c index c584b18..2a4d126 100644 --- a/ip/iprule.c +++ b/ip/iprule.c @@ -37,7 +37,7 @@ static void usage(void) __attribute__((n static void usage(void) { fprintf(stderr, "Usage: ip rule [ list | add | del | flush ] SELECTOR ACTION\n"); - fprintf(stderr, "SELECTOR := [ not ] [ from PREFIX ] [ to PREFIX ] [ tos TOS ] [ fwmark FWMARK ]\n"); + fprintf(stderr, "SELECTOR := [ not ] [ from PREFIX ] [ to PREFIX ] [ tos TOS ] [ fwmark FWMARK[/MASK] ]\n"); fprintf(stderr, " [ dev STRING ] [ pref NUMBER ]\n"); fprintf(stderr, "ACTION := [ table TABLE_ID ]\n"); fprintf(stderr, " [ prohibit | reject | unreachable ]\n"); @@ -129,8 +129,17 @@ int print_rule(const struct sockaddr_nl SPRINT_BUF(b1); fprintf(fp, "tos %s ", rtnl_dsfield_n2a(r->rtm_tos, b1, sizeof(b1))); } - if (tb[RTA_PROTOINFO]) { - fprintf(fp, "fwmark %#x ", *(__u32*)RTA_DATA(tb[RTA_PROTOINFO])); + if (tb[RTA_PROTOINFO] || tb[RTA_FWMASK]) { + __u32 mark = 0, mask = 0; + + if (tb[RTA_PROTOINFO]) + mark = *(__u32*)RTA_DATA(tb[RTA_PROTOINFO]); + + if (tb[RTA_FWMASK] && + (mask = *(__u32*)RTA_DATA(tb[RTA_FWMASK])) != 0xFFFFFFFF) + fprintf(fp, "fwmark 0x%x/0x%x ", mark, mask); + else + fprintf(fp, "fwmark 0x%x ", mark); } if (tb[RTA_IIF]) { @@ -252,11 +261,19 @@ static int iprule_modify(int cmd, int ar invarg("TOS value is invalid\n", *argv); req.r.rtm_tos = tos; } else if (strcmp(*argv, "fwmark") == 0) { - __u32 fwmark; + char *slash; + __u32 fwmark, fwmask; NEXT_ARG(); + if ((slash = strchr(*argv, '/')) != NULL) + *slash = '\0'; if (get_u32(&fwmark, *argv, 0)) invarg("fwmark value is invalid\n", *argv); addattr32(&req.n, sizeof(req), RTA_PROTOINFO, fwmark); + if (slash) { + if (get_u32(&fwmask, slash+1, 0)) + invarg("fwmask value is invalid\n", slash+1); + addattr32(&req.n, sizeof(req), RTA_FWMASK, fwmask); + } } else if (matches(*argv, "realms") == 0) { __u32 realm; NEXT_ARG(); diff --git a/man/man8/ip.8 b/man/man8/ip.8 index 12da6d5..a9132da 100644 --- a/man/man8/ip.8 +++ b/man/man8/ip.8 @@ -223,7 +223,7 @@ throw " | " unreachable " | " prohibit " .B tos .IR TOS " ] [ " .B fwmark -.IR FWMARK " ] [ " +.IR FWMARK[/MASK] " ] [ " .B dev .IR STRING " ] [ " .B pref ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: iproute2 update 2006-12-05 18:17 iproute2 update Stephen Hemminger 2006-12-05 18:43 ` Patrick McHardy @ 2006-12-06 3:58 ` Masahide NAKAMURA 1 sibling, 0 replies; 16+ messages in thread From: Masahide NAKAMURA @ 2006-12-06 3:58 UTC (permalink / raw) To: Stephen Hemminger; +Cc: Jamal, Thomas Graf, netdev Stephen Hemminger wrote: > I am about to push out a new version, so if you have any more patches pending > the window is about to close. > > Please retest with current git tree > Brief tests for MIPv6 xfrm are passed with the tree on kernel 2.6.19. -- Masahide NAKAMURA ^ permalink raw reply [flat|nested] 16+ messages in thread
* Iproute2: update @ 2005-01-12 20:59 Stephen Hemminger 2005-01-16 17:09 ` jamal 2005-03-21 20:11 ` Lennert Buytenhek 0 siblings, 2 replies; 16+ messages in thread From: Stephen Hemminger @ 2005-01-12 20:59 UTC (permalink / raw) To: netdev There is an new version of iproute2 for testing. http://developer.osdl.org/dev/iproute2/download/iproute2-2.6.10-ss050112.tar.gz Mostly simple merges, but could have some issues. Jamal did I get everything you sent? [Masahide Nakamura] ipmonitor shows IPv6 prefix list notification update to iproute2 xfrm for ipv6 [Stephen Hemminger] fix compile warnings when building 64bit system don't include <asm/byteorder.h> warning about "ip route nat" no longer supported [Catalin(ux aka Dino) BOIE] fwmark in u32 filters [Andi Kleen] netlink manual page [Thomas Graf] tc testsuite [Jamal Hadi Salim] iptables tc support mirror and redirect actions -- Stephen Hemminger <shemminger@osdl.org> ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Iproute2: update 2005-01-12 20:59 Iproute2: update Stephen Hemminger @ 2005-01-16 17:09 ` jamal 2005-01-16 17:45 ` Jamal Hadi Salim 2005-03-21 20:11 ` Lennert Buytenhek 1 sibling, 1 reply; 16+ messages in thread From: jamal @ 2005-01-16 17:09 UTC (permalink / raw) To: Stephen Hemminger; +Cc: netdev [-- Attachment #1: Type: text/plain, Size: 804 bytes --] Here's one fix cheers, jamal On Wed, 2005-01-12 at 15:59, Stephen Hemminger wrote: > There is an new version of iproute2 for testing. > http://developer.osdl.org/dev/iproute2/download/iproute2-2.6.10-ss050112.tar.gz > > Mostly simple merges, but could have some issues. > Jamal did I get everything you sent? > > [Masahide Nakamura] > ipmonitor shows IPv6 prefix list notification > update to iproute2 xfrm for ipv6 > > [Stephen Hemminger] > fix compile warnings when building 64bit system > don't include <asm/byteorder.h> > warning about "ip route nat" no longer supported > > [Catalin(ux aka Dino) BOIE] > fwmark in u32 filters > > [Andi Kleen] > netlink manual page > > [Thomas Graf] > tc testsuite > > [Jamal Hadi Salim] > iptables tc support > mirror and redirect actions > [-- Attachment #2: m_p_tc --] [-- Type: text/plain, Size: 310 bytes --] --- a/tc/m_mirred.c 2005-01-12 15:19:46.000000000 -0500 +++ b-mod/tc/m_mirred.c 2005-01-16 11:51:59.217756280 -0500 @@ -303,7 +303,7 @@ return 0; } -struct action_util mirred_util = { +struct action_util mirred_action_util = { .id = "mirred", .parse_aopt = parse_mirred, .print_aopt = print_mirred, ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Iproute2: update 2005-01-16 17:09 ` jamal @ 2005-01-16 17:45 ` Jamal Hadi Salim 2005-01-17 19:39 ` Thomas Graf ` (2 more replies) 0 siblings, 3 replies; 16+ messages in thread From: Jamal Hadi Salim @ 2005-01-16 17:45 UTC (permalink / raw) To: Stephen Hemminger; +Cc: netdev [-- Attachment #1: Type: text/plain, Size: 333 bytes --] On Sun, 2005-01-16 at 12:09, jamal wrote: > Here's one fix > And another one from before that is missing from the current version. Also something for the makefile - You may be unhappy with the way the IPT_INCL is defined in the makefile. Feel free to move it to configure etc or even kill it if it works without it. cheers, jamal [-- Attachment #2: pedit-patch-iproute2-2.6.10 --] [-- Type: text/plain, Size: 24321 bytes --] --- a/tc/Makefile 2005-01-12 15:19:46.000000000 -0500 +++ b/tc/Makefile 2005-01-15 12:59:03.994966464 -0500 @@ -23,6 +23,12 @@ TCMODULES += m_gact.o TCMODULES += m_mirred.o TCMODULES += m_ipt.o +#pedit +TCMODULES += m_pedit.o +TCMODULES += p_ip.o +TCMODULES += p_icmp.o +TCMODULES += p_tcp.o +TCMODULES += p_udp.o TCOBJ += $(TCMODULES) @@ -31,8 +37,6 @@ TCLIB += tc_cbq.o TCLIB += tc_estimator.o -CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB - TCSO := TCSO += q_netem.so @@ -40,10 +44,13 @@ TCSO += q_atm.so endif + NETEM_DIST := normal.dist pareto.dist paretonormal.dist +IPT_INCL = /root/iptables-1.2.11/include LDLIBS += -L. -ltc -lm -ldl +CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB -I$(IPT_INCL) LDFLAGS += -Wl,-export-dynamic %.so: %.c @@ -78,4 +85,3 @@ q_atm.so: q_atm.c $(CC) $(CFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm - diff -druN a/include/linux/tc_act/tc_pedit.h b/include/linux/tc_act/tc_pedit.h --- a/include/linux/tc_act/tc_pedit.h 1969-12-31 19:00:00.000000000 -0500 +++ b/include/linux/tc_act/tc_pedit.h 2004-12-28 09:31:34.000000000 -0500 @@ -0,0 +1,36 @@ +#ifndef __LINUX_TC_PED_H +#define __LINUX_TC_PED_H + +#include <linux/pkt_cls.h> + +#define TCA_ACT_PEDIT 7 + +enum +{ + TCA_PEDIT_UNSPEC, + TCA_PEDIT_TM, + TCA_PEDIT_PARMS, + __TCA_PEDIT_MAX +}; +#define TCA_PEDIT_MAX (__TCA_PEDIT_MAX - 1) + +struct tc_pedit_key +{ + __u32 mask; /* AND */ + __u32 val; /*XOR */ + __u32 off; /*offset */ + __u32 at; + __u32 offmask; + __u32 shift; +}; + +struct tc_pedit_sel +{ + tc_gen; + unsigned char nkeys; + unsigned char flags; + struct tc_pedit_key keys[0]; +}; +#define tc_pedit tc_pedit_sel + +#endif diff -druN a/tc/m_pedit.c b/tc/m_pedit.c --- a/tc/m_pedit.c 1969-12-31 19:00:00.000000000 -0500 +++ b/tc/m_pedit.c 2005-01-04 06:47:23.113260368 -0500 @@ -0,0 +1,606 @@ +/* + * m_pedit.c generic packet editor actions module + * + * This program is free software; you can distribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Authors: J Hadi Salim (hadi@cyberus.ca) + * + * TODO: + * 1) Big endian broken in some spots + * 2) A lot of this stuff was added on the fly; get a big double-double + * and clean it up at some point. + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <syslog.h> +#include <fcntl.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <string.h> +#include <dlfcn.h> +#include "utils.h" +#include "tc_util.h" +#include "m_pedit.h" + +void *pBODY; +static struct m_pedit_util *pedit_list; +int pedit_debug = 1; + +static void +p_explain(void) +{ + fprintf(stderr, "Usage: ... pedit <MUNGE>\n"); + fprintf(stderr, + "Where: MUNGE := <RAW>|<LAYERED>\n" + "<RAW>:= <OFFSETC>[ATC]<CMD>\n " + "OFFSETC:= offset <offval> <u8|u16|u32>\n " + "ATC:= at <atval> offmask <maskval> shift <shiftval>\n " + "NOTE: offval is byte offset, must be multiple of 4\n " + "NOTE: maskval is a 32 bit hex number\n " + "NOTE: shiftval is a is a shift value\n " + "CMD:= clear | invert | set <setval>| retain\n " + "<LAYERED>:= ip <ipdata> | ip6 <ip6data> \n " + " | udp <udpdata> | tcp <tcpdata> | icmp <icmpdata> \n" + "For Example usage look at the examples directory"); + +} + +#define usage() return(-1) + +static int +pedit_parse_nopopt (int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) +{ + int argc = *argc_p; + char **argv = *argv_p; + + if (argc) { + fprintf(stderr, "Unknown action hence option \"%s\" is unparsable\n", *argv); + return -1; + } + + return 0; + +} + +struct m_pedit_util +*get_pedit_kind(char *str) +{ + void *dlh; + char buf[256]; + struct m_pedit_util *p; + + for (p = pedit_list; p; p = p->next) { + if (strcmp(p->id, str) == 0) + return p; + } + + snprintf(buf, sizeof(buf), "p_%s.so", str); + dlh = dlopen(buf, RTLD_LAZY); + if (dlh == NULL) { + dlh = pBODY; + if (dlh == NULL) { + dlh = pBODY = dlopen(NULL, RTLD_LAZY); + if (dlh == NULL) + goto noexist; + } + } + + snprintf(buf, sizeof(buf), "p_pedit_%s", str); + p = dlsym(dlh, buf); + if (p == NULL) + goto noexist; + +reg: + p->next = pedit_list; + pedit_list = p; + return p; + +noexist: + p = malloc(sizeof(*p)); + if (p) { + memset(p, 0, sizeof(*p)); + strncpy(p->id, str, 15); + p->parse_peopt = pedit_parse_nopopt; + goto reg; + } + return p; +} + +int +pack_key(struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) +{ + int hwm = sel->nkeys; + + if (hwm >= MAX_OFFS) + return -1; + + if (tkey->off % 4) { + fprintf(stderr, "offsets MUST be in 32 bit boundaries\n"); + return -1; + } + + sel->keys[hwm].val = tkey->val; + sel->keys[hwm].mask = tkey->mask; + sel->keys[hwm].off = tkey->off; + sel->keys[hwm].at = tkey->at; + sel->keys[hwm].offmask = tkey->offmask; + sel->keys[hwm].shift = tkey->shift; + sel->nkeys++; + return 0; +} + + +int +pack_key32(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) +{ + if (tkey->off > (tkey->off & ~3)) { + fprintf(stderr, + "pack_key32: 32 bit offsets must begin in 32bit boundaries\n"); + return -1; + } + + tkey->val = htonl(tkey->val & retain); + tkey->mask = htonl(tkey->mask | ~retain); + /* jamal remove this - it is not necessary given the if check above */ + tkey->off &= ~3; + return pack_key(sel,tkey); +} + +int +pack_key16(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) +{ + int ind = 0, stride = 0; + __u32 m[4] = {0xFFFF0000,0xFF0000FF,0x0000FFFF}; + + if (0 > tkey->off) { + ind = tkey->off + 1; + if (0 > ind) + ind = -1*ind; + } else { + ind = tkey->off; + } + + if (tkey->val > 0xFFFF || tkey->mask > 0xFFFF) { + fprintf(stderr, "pack_key16 bad value\n"); + return -1; + } + + ind = tkey->off & 3; + + if (0 > ind || 2 < ind) { + fprintf(stderr, "pack_key16 bad index value %d\n",ind); + return -1; + } + + stride = 8 * ind; + tkey->val = htons(tkey->val); + if (stride > 0) { + tkey->val <<= stride; + tkey->mask <<= stride; + retain <<= stride; + } + tkey->mask = retain|m[ind]; + + tkey->off &= ~3; + + if (pedit_debug) + printf("pack_key16: Final val %08x mask %08x \n",tkey->val,tkey->mask); + return pack_key(sel,tkey); + +} + +int +pack_key8(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) +{ + int ind = 0, stride = 0; + __u32 m[4] = {0xFFFFFF00,0xFFFF00FF,0xFF00FFFF,0x00FFFFFF}; + + if (0 > tkey->off) { + ind = tkey->off + 1; + if (0 > ind) + ind = -1*ind; + } else { + ind = tkey->off; + } + + if (tkey->val > 0xFF || tkey->mask > 0xFF) { + fprintf(stderr, "pack_key8 bad value (val %x mask %x\n", tkey->val, tkey->mask); + return -1; + } + + ind = tkey->off & 3; + stride = 8 * ind; + tkey->val <<= stride; + tkey->mask <<= stride; + retain <<= stride; + tkey->mask = retain|m[ind]; + tkey->off &= ~3; + + if (pedit_debug) + printf("pack_key8: Final word off %d val %08x mask %08x \n",tkey->off , tkey->val,tkey->mask); + return pack_key(sel,tkey); +} + +int +parse_val(int *argc_p, char ***argv_p, __u32 * val, int type) +{ + int argc = *argc_p; + char **argv = *argv_p; + + if (argc <= 0) + return -1; + + if (TINT == type) + return get_integer(val, *argv, 0); + if (TU32 == type) + return get_u32(val, *argv, 0); + if (TIPV4 == type) { + inet_prefix addr; + if (get_prefix_1(&addr, *argv, AF_INET)) { + return -1; + } + *val=addr.data[0]; + return 0; + } + if (TIPV6 == type) { + /* not implemented yet */ + return -1; + } + + return -1; +} + +int +parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type,__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) +{ + __u32 mask = 0, val = 0; + __u32 o = 0xFF; + int res = -1; + int argc = *argc_p; + char **argv = *argv_p; + + if (argc <= 0) + return -1; + + if (pedit_debug) + printf("parse_cmd argc %d %s offset %d length %d\n",argc,*argv,tkey->off,len); + + if (len == 2) + o = 0xFFFF; + if (len == 4) + o = 0xFFFFFFFF; + + if (matches(*argv, "invert") == 0) { + retain = val = mask = o; + } else if (matches(*argv, "set") == 0) { + NEXT_ARG(); + if (parse_val(&argc, &argv, &val, type)) + return -1; + } else if (matches(*argv, "preserve") == 0) { + retain = mask = o; + } else { + if (matches(*argv, "clear") != 0) + return -1; + } + + argc--; argv++; + + if (argc && matches(*argv, "retain") == 0) { + NEXT_ARG(); + if (parse_val(&argc, &argv, &retain, TU32)) + return -1; + argc--; argv++; + } + + tkey->val = val; + + if (len == 1) { + tkey->mask = 0xFF; + res = pack_key8(retain,sel,tkey); + goto done; + } + if (len == 2) { + tkey->mask = mask; + res = pack_key16(retain,sel,tkey); + goto done; + } + if (len == 4) { + tkey->mask = mask; + res = pack_key32(retain,sel,tkey); + goto done; + } + + return -1; +done: + if (pedit_debug) + printf("parse_cmd done argc %d %s offset %d length %d\n",argc,*argv,tkey->off,len); + *argc_p = argc; + *argv_p = argv; + return res; + +} + +int +parse_offset(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) +{ + int off; + __u32 len, retain; + int argc = *argc_p; + char **argv = *argv_p; + int res = -1; + + if (argc <= 0) + return -1; + + if (get_integer(&off, *argv, 0)) + return -1; + tkey->off = off; + + argc--; + argv++; + + if (argc <= 0) + return -1; + + + if (matches(*argv, "u32") == 0) { + len = 4; + retain = 0xFFFFFFFF; + goto done; + } + if (matches(*argv, "u16") == 0) { + len = 2; + retain = 0x0; + goto done; + } + if (matches(*argv, "u8") == 0) { + len = 1; + retain = 0x0; + goto done; + } + + return -1; + +done: + + NEXT_ARG(); + + /* [at <someval> offmask <maskval> shift <shiftval>] */ + if (matches(*argv, "at") == 0) { + + __u32 atv=0,offmask=0x0,shift=0; + + NEXT_ARG(); + if (get_u32(&atv, *argv, 0)) + return -1; + tkey->at = atv; + + NEXT_ARG(); + + if (get_u32(&offmask, *argv, 16)) + return -1; + tkey->offmask = offmask; + + NEXT_ARG(); + + if (get_u32(&shift, *argv, 0)) + return -1; + tkey->shift = shift; + + NEXT_ARG(); + } + + res = parse_cmd(&argc, &argv, len, TU32,retain,sel,tkey); + + *argc_p = argc; + *argv_p = argv; + return res; +} + +int +parse_munge(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel) +{ + struct tc_pedit_key tkey; + int argc = *argc_p; + char **argv = *argv_p; + int res = -1; + + if (argc <= 0) + return -1; + + memset(&tkey, 0, sizeof(tkey)); + + if (matches(*argv, "offset") == 0) { + NEXT_ARG(); + res = parse_offset(&argc, &argv,sel,&tkey); + goto done; +#if jamal + } else if (strcmp(*argv, "help") == 0) { + p_explain(); + return -1; +#endif + } else { + char k[16]; + struct m_pedit_util *p = NULL; + + strncpy(k, *argv, sizeof (k) - 1); + + if (argc > 0 ) { + p = get_pedit_kind(k); + if (NULL == p) + goto bad_val; + res = p->parse_peopt(&argc, &argv, sel,&tkey); + if (res < 0) { + fprintf(stderr,"bad pedit parsing\n"); + goto bad_val; + } + goto done; + } + } + +bad_val: + return -1; + +done: + + *argc_p = argc; + *argv_p = argv; + return res; +} + +int +parse_pedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) +{ + struct { + struct tc_pedit_sel sel; + struct tc_pedit_key keys[MAX_OFFS]; + } sel; + + int argc = *argc_p; + char **argv = *argv_p; + int ok = 0, iok = 0; + struct rtattr *tail; + + memset(&sel, 0, sizeof(sel)); + + while (argc > 0) { + if (pedit_debug > 1) + fprintf(stderr, "while pedit (%d:%s)\n",argc, *argv); + if (matches(*argv, "pedit") == 0) { + NEXT_ARG(); + ok++; + continue; + } else if (matches(*argv, "munge") == 0) { + if (!ok) { + fprintf(stderr, "Illegal pedit construct (%s) \n", *argv); + p_explain(); + return -1; + } + NEXT_ARG(); + if (parse_munge(&argc, &argv,&sel.sel)) { + fprintf(stderr, "Illegal pedit construct (%s) \n", *argv); + p_explain(); + return -1; + } + ok++; + } else { + break; + } + + } + + if (!ok) { + p_explain(); + return -1; + } + + if (argc) { + if (matches(*argv, "reclassify") == 0) { + sel.sel.action = TC_ACT_RECLASSIFY; + NEXT_ARG(); + } else if (matches(*argv, "pipe") == 0) { + sel.sel.action = TC_ACT_PIPE; + NEXT_ARG(); + } else if (matches(*argv, "drop") == 0 || + matches(*argv, "shot") == 0) { + sel.sel.action = TC_ACT_SHOT; + NEXT_ARG(); + } else if (matches(*argv, "continue") == 0) { + sel.sel.action = TC_ACT_UNSPEC; + NEXT_ARG(); + } else if (matches(*argv, "pass") == 0) { + sel.sel.action = TC_ACT_OK; + NEXT_ARG(); + } + } + + if (argc) { + if (matches(*argv, "index") == 0) { + NEXT_ARG(); + if (get_u32(&sel.sel.index, *argv, 10)) { + fprintf(stderr, "Pedit: Illegal \"index\"\n"); + return -1; + } + argc--; + argv++; + iok++; + } + } + + tail = (struct rtattr *) (((void *) n) + NLMSG_ALIGN(n->nlmsg_len)); + addattr_l(n, MAX_MSG, tca_id, NULL, 0); + addattr_l(n, MAX_MSG, TCA_PEDIT_PARMS,&sel, sizeof(sel.sel)+sel.sel.nkeys*sizeof(struct tc_pedit_key)); + tail->rta_len = + (((void *) n) + NLMSG_ALIGN(n->nlmsg_len)) - (void *) tail; + + *argc_p = argc; + *argv_p = argv; + return 0; +} + +int +print_pedit(struct action_util *au,FILE * f, struct rtattr *arg) +{ + struct tc_pedit_sel *sel; + struct rtattr *tb[TCA_PEDIT_MAX + 1]; + SPRINT_BUF(b1); + + if (arg == NULL) + return -1; + + memset(tb, 0, sizeof (tb)); + parse_rtattr(tb, TCA_PEDIT_MAX, RTA_DATA(arg), RTA_PAYLOAD(arg)); + + if (tb[TCA_PEDIT_PARMS] == NULL) { + fprintf(f, "[NULL pedit parameters]"); + return -1; + } + sel = RTA_DATA(tb[TCA_PEDIT_PARMS]); + + fprintf(f, " pedit action %s keys %d\n ", action_n2a(sel->action, b1, sizeof (b1)),sel->nkeys); + fprintf(f, "\t index %d ref %d bind %d", sel->index,sel->refcnt, sel->bindcnt); + + if (show_stats) { + if (tb[TCA_PEDIT_TM]) { + struct tcf_t *tm = RTA_DATA(tb[TCA_PEDIT_TM]); + print_tm(f,tm); + } + } + if (sel->nkeys) { + int i; + struct tc_pedit_key *key = sel->keys; + + for (i=0; i<sel->nkeys; i++, key++) { + fprintf(f, "\n\t key #%d",i); + fprintf(f, " at %d: val %08x mask %08x", + (unsigned int)key->off, + (unsigned int)ntohl(key->val), + (unsigned int)ntohl(key->mask)); + } + } else { + fprintf(f, "\npedit %x keys %d is not LEGIT", sel->index,sel->nkeys); + } + + + fprintf(f, "\n "); + return 0; +} + +int +pedit_print_xstats(struct action_util *au, FILE *f, struct rtattr *xstats) +{ + return 0; +} + +struct action_util pedit_action_util = { + .id = "pedit", + .parse_aopt = parse_pedit, + .print_aopt = print_pedit, +}; diff -druN a/tc/m_pedit.h b/tc/m_pedit.h --- a/tc/m_pedit.h 1969-12-31 19:00:00.000000000 -0500 +++ b/tc/m_pedit.h 2004-12-28 09:31:34.000000000 -0500 @@ -0,0 +1,60 @@ +/* + * m_pedit.h generic packet editor actions module + * + * This program is free software; you can distribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Authors: J Hadi Salim (hadi@cyberus.ca) + * + */ + +#ifndef _ACT_PEDIT_H_ +#define _ACT_PEDIT_H_ 1 + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <syslog.h> +#include <fcntl.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <string.h> +#include "utils.h" +#include "tc_util.h" +#include <linux/tc_act/tc_pedit.h> + +#define MAX_OFFS 128 + +#define TIPV4 1 +#define TIPV6 2 +#define TINT 3 +#define TU32 4 + +#define RU32 0xFFFFFFFF +#define RU16 0xFFFF +#define RU8 0xFF + +struct m_pedit_util +{ + struct m_pedit_util *next; + char id[16]; + int (*parse_peopt)(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey); +}; + + +extern int parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type,__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey); +extern int pack_key(struct tc_pedit_sel *sel,struct tc_pedit_key *tkey); +extern int pack_key32(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey); +extern int pack_key16(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey); +extern int pack_key8(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey); +extern int parse_val(int *argc_p, char ***argv_p, __u32 * val, int type); +extern int parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type,__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey); +extern int parse_offset(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey); +int parse_pedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n); +extern int print_pedit(struct action_util *au,FILE * f, struct rtattr *arg); +extern int pedit_print_xstats(struct action_util *au, FILE *f, struct rtattr *xstats); + +#endif diff -druN a/tc/p_icmp.c b/tc/p_icmp.c --- a/tc/p_icmp.c 1969-12-31 19:00:00.000000000 -0500 +++ b/tc/p_icmp.c 2004-12-28 09:31:34.000000000 -0500 @@ -0,0 +1,61 @@ +/* + * m_pedit_icmp.c packet editor: ICMP header + * + * This program is free software; you can distribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Authors: J Hadi Salim (hadi@cyberus.ca) + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <syslog.h> +#include <fcntl.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <string.h> +#include "utils.h" +#include "tc_util.h" +#include "m_pedit.h" + + +static int +parse_icmp(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) +{ + int res = -1; +#if 0 + int argc = *argc_p; + char **argv = *argv_p; + + if (argc < 2) + return -1; + + if (strcmp(*argv, "type") == 0) { + NEXT_ARG(); + res = parse_u8(&argc, &argv, 0); + goto done; + } + if (strcmp(*argv, "code") == 0) { + NEXT_ARG(); + res = parse_u8(&argc, &argv, 1); + goto done; + } + return -1; + + done: + *argc_p = argc; + *argv_p = argv; +#endif + return res; +} + +struct m_pedit_util p_pedit_icmp = { + NULL, + "icmp", + parse_icmp, +}; diff -druN a/tc/p_ip.c b/tc/p_ip.c --- a/tc/p_ip.c 1969-12-31 19:00:00.000000000 -0500 +++ b/tc/p_ip.c 2004-12-28 09:31:34.000000000 -0500 @@ -0,0 +1,159 @@ +/* + * m_pedit.c packet editor: IPV4/6 header + * + * This program is free software; you can distribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Authors: J Hadi Salim (hadi@cyberus.ca) + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <syslog.h> +#include <fcntl.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <string.h> +#include "utils.h" +#include "tc_util.h" +#include "m_pedit.h" + +static int +parse_ip(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) +{ + int res = -1; + int argc = *argc_p; + char **argv = *argv_p; + + if (argc < 2) + return -1; + + if (strcmp(*argv, "src") == 0) { + NEXT_ARG(); + tkey->off = 12; + res = parse_cmd(&argc, &argv, 4, TIPV4,RU32,sel,tkey); + goto done; + } + if (strcmp(*argv, "dst") == 0) { + NEXT_ARG(); + tkey->off = 16; + res = parse_cmd(&argc, &argv, 4, TIPV4,RU32,sel,tkey); + goto done; + } + /* jamal - look at these and make them either old or new + ** scheme given diffserv + ** dont forget the CE bit + */ + if (strcmp(*argv, "tos") == 0 || matches(*argv, "dsfield") == 0) { + NEXT_ARG(); + tkey->off = 1; + res = parse_cmd(&argc, &argv, 1, TU32,RU8,sel,tkey); + goto done; + } + if (strcmp(*argv, "ihl") == 0) { + NEXT_ARG(); + tkey->off = 0; + res = parse_cmd(&argc, &argv, 1, TU32,RU8,sel,tkey); + goto done; + } + if (strcmp(*argv, "protocol") == 0) { + NEXT_ARG(); + tkey->off = 9; + res = parse_cmd(&argc, &argv, 1, TU32,RU8,sel,tkey); + goto done; + } + /* jamal - fix this */ + if (matches(*argv, "precedence") == 0) { + NEXT_ARG(); + tkey->off = 1; + res = parse_cmd(&argc, &argv, 1, TU32,RU8,sel,tkey); + goto done; + } + /* jamal - validate this at some point */ + if (strcmp(*argv, "nofrag") == 0) { + NEXT_ARG(); + tkey->off = 6; + res = parse_cmd(&argc, &argv, 1, TU32,0x3F,sel,tkey); + goto done; + } + /* jamal - validate this at some point */ + if (strcmp(*argv, "firstfrag") == 0) { + NEXT_ARG(); + tkey->off = 6; + res = parse_cmd(&argc, &argv, 1, TU32,0x1F,sel,tkey); + goto done; + } + if (strcmp(*argv, "ce") == 0) { + NEXT_ARG(); + tkey->off = 6; + res = parse_cmd(&argc, &argv, 1, TU32,0x80,sel,tkey); + goto done; + } + if (strcmp(*argv, "df") == 0) { + NEXT_ARG(); + tkey->off = 6; + res = parse_cmd(&argc, &argv, 1, TU32,0x40,sel,tkey); + goto done; + } + if (strcmp(*argv, "mf") == 0) { + NEXT_ARG(); + tkey->off = 6; + res = parse_cmd(&argc, &argv, 1, TU32,0x20,sel,tkey); + goto done; + } + if (strcmp(*argv, "dport") == 0) { + NEXT_ARG(); + tkey->off = 22; + res = parse_cmd(&argc, &argv, 2, TU32,RU16,sel,tkey); + goto done; + } + if (strcmp(*argv, "sport") == 0) { + NEXT_ARG(); + tkey->off = 20; + res = parse_cmd(&argc, &argv, 2, TU32,RU16,sel,tkey); + goto done; + } + if (strcmp(*argv, "icmp_type") == 0) { + NEXT_ARG(); + tkey->off = 20; + res = parse_cmd(&argc, &argv, 1, TU32,RU8,sel,tkey); + goto done; + } + if (strcmp(*argv, "icmp_code") == 0) { + NEXT_ARG(); + tkey->off = 20; + res = parse_cmd(&argc, &argv, 1, TU32,RU8,sel,tkey); + goto done; + } + return -1; + + done: + *argc_p = argc; + *argv_p = argv; + return res; +} + +static int +parse_ip6(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) +{ + int res = -1; + return res; +} + +struct m_pedit_util p_pedit_ip = { + NULL, + "ip", + parse_ip, +}; + + +struct m_pedit_util p_pedit_ip6 = { + NULL, + "ip6", + parse_ip6, +}; diff -druN a/tc/p_tcp.c b/tc/p_tcp.c --- a/tc/p_tcp.c 1969-12-31 19:00:00.000000000 -0500 +++ b/tc/p_tcp.c 2004-12-28 09:31:34.000000000 -0500 @@ -0,0 +1,38 @@ +/* + * m_pedit_tcp.c packet editor: TCP header + * + * This program is free software; you can distribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Authors: J Hadi Salim (hadi@cyberus.ca) + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <syslog.h> +#include <fcntl.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <string.h> +#include "utils.h" +#include "tc_util.h" +#include "m_pedit.h" + +static int +parse_tcp(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) +{ + int res = -1; + return res; +} +struct m_pedit_util p_pedit_tcp = { + NULL, + "tcp", + parse_tcp, +}; + + diff -druN a/tc/p_udp.c b/tc/p_udp.c --- a/tc/p_udp.c 1969-12-31 19:00:00.000000000 -0500 +++ b/tc/p_udp.c 2004-12-28 09:31:34.000000000 -0500 @@ -0,0 +1,38 @@ +/* + * m_pedit_udp.c packet editor: UDP header + * + * This program is free software; you can distribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Authors: J Hadi Salim (hadi@cyberus.ca) + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <syslog.h> +#include <fcntl.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <string.h> +#include "utils.h" +#include "tc_util.h" +#include "m_pedit.h" + +static int +parse_udp(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) +{ + int res = -1; + return res; +} + +struct m_pedit_util p_pedit_udp = { + NULL, + "udp", + parse_udp, +}; + ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Iproute2: update 2005-01-16 17:45 ` Jamal Hadi Salim @ 2005-01-17 19:39 ` Thomas Graf 2005-01-17 20:20 ` Thomas Graf 2005-01-17 22:24 ` Stephen Hemminger 2 siblings, 0 replies; 16+ messages in thread From: Thomas Graf @ 2005-01-17 19:39 UTC (permalink / raw) To: Jamal Hadi Salim; +Cc: Stephen Hemminger, netdev * Jamal Hadi Salim <1105897532.1097.749.camel@jzny.localdomain> 2005-01-16 12:45 > On Sun, 2005-01-16 at 12:09, jamal wrote: > > Here's one fix > > > > And another one from before that is missing from the current version. > Also something for the makefile - You may be unhappy with the way the > IPT_INCL is defined in the makefile. > Feel free to move it to configure etc or even kill it if it works > without it. It seems that ipt code is still missing in stephen's bk tree so the patch doesn't apply cleanly. It's no problem to fix it but you might to provide the patch again. Stephen, I can put it into my bk tree and you can pull it together with my my changes if you want. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Iproute2: update 2005-01-16 17:45 ` Jamal Hadi Salim 2005-01-17 19:39 ` Thomas Graf @ 2005-01-17 20:20 ` Thomas Graf 2005-01-17 20:57 ` Thomas Graf 2005-01-17 22:24 ` Stephen Hemminger 2 siblings, 1 reply; 16+ messages in thread From: Thomas Graf @ 2005-01-17 20:20 UTC (permalink / raw) To: Jamal Hadi Salim; +Cc: Stephen Hemminger, netdev * Jamal Hadi Salim <1105897532.1097.749.camel@jzny.localdomain> 2005-01-16 12:45 > --- a/tc/Makefile 2005-01-12 15:19:46.000000000 -0500 > +++ b/tc/Makefile 2005-01-15 12:59:03.994966464 -0500 > @@ -23,6 +23,12 @@ > TCMODULES += m_gact.o > TCMODULES += m_mirred.o > TCMODULES += m_ipt.o > +#pedit > +TCMODULES += m_pedit.o > +TCMODULES += p_ip.o > +TCMODULES += p_icmp.o > +TCMODULES += p_tcp.o > +TCMODULES += p_udp.o > > TCOBJ += $(TCMODULES) > > @@ -31,8 +37,6 @@ > TCLIB += tc_cbq.o > TCLIB += tc_estimator.o > > -CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB > - > > TCSO := > TCSO += q_netem.so > @@ -40,10 +44,13 @@ > TCSO += q_atm.so > endif > > + > NETEM_DIST := normal.dist pareto.dist paretonormal.dist > > +IPT_INCL = /root/iptables-1.2.11/include I moved this to configure: --- 1.9/configure 2004-12-08 21:12:11 +01:00 +++ edited/configure 2005-01-17 20:55:38 +01:00 @@ -42,3 +42,17 @@ echo "TC_CONFIG_ACTION_MIRRED=y" >>Config fi +if [ -e "tc/m_ipt.c" ] +then + echo " IPT found" + echo "Enter path to iptables source directory or \"disable\"" + echo -n "Path: " + read PATH + if [ "$PATH" = "disable" ] + then + echo "TC_CONFIG_ACTION_IPT=n" >>Config + else + echo "TC_CONFIG_ACTION_IPT=y" >>Config + echo "IPT_INCL=${PATH}/include" >>Config + fi +fi and the Makefile part: --- 1.21/tc/Makefile 2004-12-08 21:12:11 +01:00 +++ edited/tc/Makefile 2005-01-17 20:49:36 +01:00 @@ -21,7 +21,15 @@ TCMODULES += q_hfsc.o TCMODULES += q_htb.o TCMODULES += m_gact.o +ifeq ($(TC_CONFIG_ACTION_IPT),y) +TCMODULES += m_ipt.o +endif TCMODULES += m_mirred.o +TCMODULES += m_pedit.o +TCMODULES += p_ip.o +TCMODULES += p_icmp.o +TCMODULES += p_tcp.o +TCMODULES += p_udp.o TCOBJ += $(TCMODULES) @@ -30,8 +38,7 @@ TCLIB += tc_cbq.o TCLIB += tc_estimator.o -CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB - +CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB -I$(IPT_INCL) TCSO := TCSO += q_netem.so > +struct m_pedit_util > +*get_pedit_kind(char *str) > +{ > + void *dlh; > + char buf[256]; > + struct m_pedit_util *p; > + > + for (p = pedit_list; p; p = p->next) { > + if (strcmp(p->id, str) == 0) > + return p; > + } > + > + snprintf(buf, sizeof(buf), "p_%s.so", str); > + dlh = dlopen(buf, RTLD_LAZY); > + if (dlh == NULL) { > + dlh = pBODY; > + if (dlh == NULL) { > + dlh = pBODY = dlopen(NULL, RTLD_LAZY); > + if (dlh == NULL) > + goto noexist; I made pBODY a static variable within get_pedit_kind. same in m_action.c > +noexist: > + p = malloc(sizeof(*p)); > + if (p) { > + memset(p, 0, sizeof(*p)); > + strncpy(p->id, str, 15); > + p->parse_peopt = pedit_parse_nopopt; > + goto reg; Quite hacky ;-> > +int > +pack_key32(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) > +{ > + if (tkey->off > (tkey->off & ~3)) { > + fprintf(stderr, > + "pack_key32: 32 bit offsets must begin in 32bit boundaries\n"); > + return -1; > + } > + > + tkey->val = htonl(tkey->val & retain); > + tkey->mask = htonl(tkey->mask | ~retain); > + /* jamal remove this - it is not necessary given the if check above */ > + tkey->off &= ~3; Are there multiple of you? ;-> > +int > +pack_key16(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) > +{ > + int ind = 0, stride = 0; > + __u32 m[4] = {0xFFFF0000,0xFF0000FF,0x0000FFFF}; Missing check for 16bit boundry? You can also completely remove theses issues by writing in 8bit chunks. OTOH, the user can request you to do so, so no problem. > +#if jamal > + } else if (strcmp(*argv, "help") == 0) { > + p_explain(); > + return -1; > +#endif So you think you're the only one worth giving help? ;-> Just kidding. > + tail = (struct rtattr *) (((void *) n) + NLMSG_ALIGN(n->nlmsg_len)); > + addattr_l(n, MAX_MSG, tca_id, NULL, 0); > + addattr_l(n, MAX_MSG, TCA_PEDIT_PARMS,&sel, sizeof(sel.sel)+sel.sel.nkeys*sizeof(struct tc_pedit_key)); > + tail->rta_len = > + (((void *) n) + NLMSG_ALIGN(n->nlmsg_len)) - (void *) tail; I changed this and all other occurences to use the NLMSG_TAIL macro (added in my tree) +#define NLMSG_TAIL(nmsg) \ + ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len))) > +struct m_pedit_util > +{ > + struct m_pedit_util *next; > + char id[16]; I made this a PEDITKINDSIZ and made the strncpy's use it I'll put this changes into my tree given you're fine with it and stephen can pull them. As I said, the ipt code is still missing, I can merge them into my tree as well if you want. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Iproute2: update 2005-01-17 20:20 ` Thomas Graf @ 2005-01-17 20:57 ` Thomas Graf 2005-01-17 21:39 ` jamal 0 siblings, 1 reply; 16+ messages in thread From: Thomas Graf @ 2005-01-17 20:57 UTC (permalink / raw) To: Jamal Hadi Salim; +Cc: Stephen Hemminger, netdev > I'll put this changes into my tree given you're fine with it and stephen > can pull them. As I said, the ipt code is still missing, I can merge > them into my tree as well if you want. Stephen: you can pull jamal's changes with my modifications from bk://tgr.bkbits.net/iproute2-tgr if you like. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Iproute2: update 2005-01-17 20:57 ` Thomas Graf @ 2005-01-17 21:39 ` jamal 2005-01-17 22:24 ` Thomas Graf 0 siblings, 1 reply; 16+ messages in thread From: jamal @ 2005-01-17 21:39 UTC (permalink / raw) To: Thomas Graf; +Cc: Stephen Hemminger, netdev On Mon, 2005-01-17 at 15:57, Thomas Graf wrote: > > I'll put this changes into my tree given you're fine with it and stephen > > can pull them. As I said, the ipt code is still missing, I can merge > > them into my tree as well if you want. > > Stephen: you can pull jamal's changes with my modifications from > bk://tgr.bkbits.net/iproute2-tgr if you like. Thomas, Look at iproute2-2.6.10-ss050112 - ipt is in there and thats where my patches are against. ---- [hadi@jzny hadi]$ find iproute2-2.6.10-ss050112 | grep ipt iproute2-2.6.10-ss050112/examples/dhcp-client-script iproute2-2.6.10-ss050112/tc/m_ipt.c iproute2-2.6.10-ss050112/ip/iptunnel.c iproute2-2.6.10-ss050112/include/iptables.h iproute2-2.6.10-ss050112/include/libiptc iproute2-2.6.10-ss050112/include/libiptc/ipt_kernel_headers.h iproute2-2.6.10-ss050112/include/libiptc/libip6tc.h iproute2-2.6.10-ss050112/include/libiptc/libiptc.h iproute2-2.6.10-ss050112/include/iptables_common.h iproute2-2.6.10-ss050112/include/linux/tc_act/tc_ipt.h ----------- Seems like Stephen now also included the iptables headers too. Hopefuly iptables wont be fluctuating as much anymore. So the IPT thing is unneeded. Also note that i had it the way you have it in configure but Stephen didnt like it. In regards to pedit - wait until the code goes in then shoot at it. Theres plenty of things for you to shoot at ;-> i think last time i really looked at it was ~2 years ago. Work it out with Stephen, if he wants to pull changes off you thats fine with me. cheers, jamal ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Iproute2: update 2005-01-17 21:39 ` jamal @ 2005-01-17 22:24 ` Thomas Graf 2005-01-17 22:39 ` jamal 0 siblings, 1 reply; 16+ messages in thread From: Thomas Graf @ 2005-01-17 22:24 UTC (permalink / raw) To: jamal; +Cc: Stephen Hemminger, netdev * jamal <1105997946.1078.308.camel@jzny.localdomain> 2005-01-17 16:39 > On Mon, 2005-01-17 at 15:57, Thomas Graf wrote: > > > I'll put this changes into my tree given you're fine with it and stephen > > > can pull them. As I said, the ipt code is still missing, I can merge > > > them into my tree as well if you want. > > > > Stephen: you can pull jamal's changes with my modifications from > > bk://tgr.bkbits.net/iproute2-tgr if you like. > > Thomas, > > Look at iproute2-2.6.10-ss050112 - ipt is in there and thats where my > patches are against. > > ---- > [hadi@jzny hadi]$ find iproute2-2.6.10-ss050112 | grep ipt > iproute2-2.6.10-ss050112/examples/dhcp-client-script > iproute2-2.6.10-ss050112/tc/m_ipt.c > iproute2-2.6.10-ss050112/ip/iptunnel.c > iproute2-2.6.10-ss050112/include/iptables.h > iproute2-2.6.10-ss050112/include/libiptc > iproute2-2.6.10-ss050112/include/libiptc/ipt_kernel_headers.h > iproute2-2.6.10-ss050112/include/libiptc/libip6tc.h > iproute2-2.6.10-ss050112/include/libiptc/libiptc.h > iproute2-2.6.10-ss050112/include/iptables_common.h > iproute2-2.6.10-ss050112/include/linux/tc_act/tc_ipt.h > ----------- Ah, great. I didn't look at the release and they're not in the bk tree. Maybe stephen forgot to push his changes. > So the IPT thing is unneeded. Also note that i had it the way you > have it in configure but Stephen didnt like it. OK. I don't care, it's really ugly to compile iproute2 without iptables sources though. > In regards to pedit - wait until the code goes in then shoot at it. > Theres plenty of things for you to shoot at ;-> i think last time i > really looked at it was ~2 years ago. I'll keep those changes and eventually merge them sometimes. It's not that important. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Iproute2: update 2005-01-17 22:24 ` Thomas Graf @ 2005-01-17 22:39 ` jamal 0 siblings, 0 replies; 16+ messages in thread From: jamal @ 2005-01-17 22:39 UTC (permalink / raw) To: Thomas Graf; +Cc: Stephen Hemminger, netdev On Mon, 2005-01-17 at 17:24, Thomas Graf wrote: > > I'll keep those changes and eventually merge them sometimes. It's not > that important. np - they all look good except the one where you refer to me as talking to myself ;-> cheers, jamal ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Iproute2: update 2005-01-16 17:45 ` Jamal Hadi Salim 2005-01-17 19:39 ` Thomas Graf 2005-01-17 20:20 ` Thomas Graf @ 2005-01-17 22:24 ` Stephen Hemminger 2 siblings, 0 replies; 16+ messages in thread From: Stephen Hemminger @ 2005-01-17 22:24 UTC (permalink / raw) To: hadi; +Cc: netdev On 16 Jan 2005 12:45:32 -0500 Jamal Hadi Salim <hadi@znyx.com> wrote: > On Sun, 2005-01-16 at 12:09, jamal wrote: > > Here's one fix > > > > And another one from before that is missing from the current version. > Also something for the makefile - You may be unhappy with the way the > IPT_INCL is defined in the makefile. Yup, I am not going to let the in. I put the iptables headers needed in include. > Feel free to move it to configure etc or even kill it if it works > without it. > > cheers, > jamal -- Stephen Hemminger <shemminger@osdl.org> ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Iproute2: update 2005-01-12 20:59 Iproute2: update Stephen Hemminger 2005-01-16 17:09 ` jamal @ 2005-03-21 20:11 ` Lennert Buytenhek 2005-03-29 18:09 ` Stephen Hemminger 1 sibling, 1 reply; 16+ messages in thread From: Lennert Buytenhek @ 2005-03-21 20:11 UTC (permalink / raw) To: Stephen Hemminger; +Cc: netdev On Wed, Jan 12, 2005 at 12:59:03PM -0800, Stephen Hemminger wrote: > There is an new version of iproute2 for testing. > http://developer.osdl.org/dev/iproute2/download/iproute2-2.6.10-ss050112.tar.gz Doesn't build on my box (ARM platform): gcc -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -g -I../include -DRESOLVE_HOSTNAMES -DCONFIG_GACT -DCONFIG_GACT_PROB -o normal normal.c -lm ./normal >normal.dist *** glibc detected *** double free or corruption: 0x00011050 *** /bin/sh: line 1: 30106 Aborted ./normal >normal.dist make[1]: *** [normal.dist] Error 134 The same thing for paretonormal. TABLESIZE is 16384, and some debug code shows that it's trying to write one element past the end of the table: setting table[16384] to 4.008800 setting table[16384] to 4.008850 [...] setting table[16384] to 10.049950 setting table[16384] to 10.050000 I thought it was a floating point emulation bug at first, but it also appears to do this on my x86. We don't use table[16384] anyway, so this works: --L --- iproute2-2.6.9/tc/paretonormal.c.orig 2005-03-21 21:04:21.863592000 +0100 +++ iproute2-2.6.9/tc/paretonormal.c 2005-03-21 21:07:34.590781000 +0100 @@ -62,7 +62,8 @@ for (x = -10.0; x < 10.05; x += .00005) { i = (int)rint(TABLESIZE*normal(x, 0.0, 1.0)); - table[i] = x; + if (i >= 0 && i < TABLESIZE) + table[i] = x; } printf( "# This is the distribution table for the paretonormal distribution.\n" --- iproute2-2.6.9/tc/normal.c.orig 2005-03-21 21:00:40.420057000 +0100 +++ iproute2-2.6.9/tc/normal.c 2005-03-21 21:01:08.040316000 +0100 @@ -35,7 +35,8 @@ for (x = -10.0; x < 10.05; x += .00005) { i = (int)rint(TABLESIZE*normal(x, 0.0, 1.0)); - table[i] = x; + if (i >= 0 && i < TABLESIZE) + table[i] = x; } ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Iproute2: update 2005-03-21 20:11 ` Lennert Buytenhek @ 2005-03-29 18:09 ` Stephen Hemminger 2005-03-29 19:07 ` Lennert Buytenhek 0 siblings, 1 reply; 16+ messages in thread From: Stephen Hemminger @ 2005-03-29 18:09 UTC (permalink / raw) To: Lennert Buytenhek; +Cc: netdev On Mon, 21 Mar 2005 21:11:28 +0100 Lennert Buytenhek <buytenh@wantstofly.org> wrote: > On Wed, Jan 12, 2005 at 12:59:03PM -0800, Stephen Hemminger wrote: > > > There is an new version of iproute2 for testing. > > http://developer.osdl.org/dev/iproute2/download/iproute2-2.6.10-ss050112.tar.gz > > Doesn't build on my box (ARM platform): > > gcc -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -g -I../include -DRESOLVE_HOSTNAMES -DCONFIG_GACT -DCONFIG_GACT_PROB -o normal normal.c -lm > ./normal >normal.dist > *** glibc detected *** double free or corruption: 0x00011050 *** > /bin/sh: line 1: 30106 Aborted ./normal >normal.dist > make[1]: *** [normal.dist] Error 134 > > The same thing for paretonormal. > > TABLESIZE is 16384, and some debug code shows that it's trying to > write one element past the end of the table: > > setting table[16384] to 4.008800 > setting table[16384] to 4.008850 > [...] > setting table[16384] to 10.049950 > setting table[16384] to 10.050000 > > I thought it was a floating point emulation bug at first, but it > also appears to do this on my x86. > > We don't use table[16384] anyway, so this works: > I thought this was fixed in current versions because it allocates space for TABLESIZE+1 entries in the call to calloc. table = calloc(sizeof(double), TABLESIZE+1); ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Iproute2: update 2005-03-29 18:09 ` Stephen Hemminger @ 2005-03-29 19:07 ` Lennert Buytenhek 0 siblings, 0 replies; 16+ messages in thread From: Lennert Buytenhek @ 2005-03-29 19:07 UTC (permalink / raw) To: Stephen Hemminger; +Cc: netdev On Tue, Mar 29, 2005 at 10:09:42AM -0800, Stephen Hemminger wrote: > > TABLESIZE is 16384, and some debug code shows that it's trying to > > write one element past the end of the table: > > > > setting table[16384] to 4.008800 > > setting table[16384] to 4.008850 > > [...] > > setting table[16384] to 10.049950 > > setting table[16384] to 10.050000 > > > > I thought it was a floating point emulation bug at first, but it > > also appears to do this on my x86. > > > > We don't use table[16384] anyway, so this works: > > I thought this was fixed in current versions because it allocates > space for TABLESIZE+1 entries in the call to calloc. > > table = calloc(sizeof(double), TABLESIZE+1); I saw the problem with the FC3 version of iproute2. The newest announcement I had in my inbox was of the ss050112 version, so I downloaded that, and saw that it still had the problem. I didn't see any announcements newer than that one so I assumed that that was the latest version. I see now that the version that came after that indeed has that issue fixed, so sorry for the noise. --L ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2006-12-06 3:58 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2006-12-05 18:17 iproute2 update Stephen Hemminger 2006-12-05 18:43 ` Patrick McHardy 2006-12-06 3:58 ` Masahide NAKAMURA -- strict thread matches above, loose matches on Subject: below -- 2005-01-12 20:59 Iproute2: update Stephen Hemminger 2005-01-16 17:09 ` jamal 2005-01-16 17:45 ` Jamal Hadi Salim 2005-01-17 19:39 ` Thomas Graf 2005-01-17 20:20 ` Thomas Graf 2005-01-17 20:57 ` Thomas Graf 2005-01-17 21:39 ` jamal 2005-01-17 22:24 ` Thomas Graf 2005-01-17 22:39 ` jamal 2005-01-17 22:24 ` Stephen Hemminger 2005-03-21 20:11 ` Lennert Buytenhek 2005-03-29 18:09 ` Stephen Hemminger 2005-03-29 19:07 ` Lennert Buytenhek
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).