From: Thomas Graf <tgraf@suug.ch>
To: Jamal Hadi Salim <hadi@znyx.com>
Cc: Stephen Hemminger <shemminger@osdl.org>, netdev@oss.sgi.com
Subject: Re: Iproute2: update
Date: Mon, 17 Jan 2005 21:20:22 +0100 [thread overview]
Message-ID: <20050117202022.GG26856@postel.suug.ch> (raw)
In-Reply-To: <1105897532.1097.749.camel@jzny.localdomain>
* 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.
next prev parent reply other threads:[~2005-01-17 20:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
-- strict thread matches above, loose matches on Subject: below --
2006-12-05 18:17 iproute2 update Stephen Hemminger
2006-12-05 18:43 ` Patrick McHardy
2006-12-06 3:58 ` Masahide NAKAMURA
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050117202022.GG26856@postel.suug.ch \
--to=tgraf@suug.ch \
--cc=hadi@znyx.com \
--cc=netdev@oss.sgi.com \
--cc=shemminger@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).