# Iproute2

## Riveri

I keep getting this when i try to run my wshaper script:

```
RTNETLINK answers: Invalid argument
```

my kernel(2.6.9-rc2) looks like this...

```

#

# QoS and/or fair queueing

#

CONFIG_NET_SCHED=y

CONFIG_NET_SCH_CLK_JIFFIES=y

CONFIG_NET_SCH_CBQ=y

CONFIG_NET_SCH_HTB=y

CONFIG_NET_SCH_SFQ=y

CONFIG_NET_SCH_INGRESS=y

CONFIG_NET_QOS=y

CONFIG_NET_ESTIMATOR=y

CONFIG_NET_CLS=y

CONFIG_NET_CLS_U32=y

CONFIG_NET_CLS_POLICE=y

```

and tc -V gives:

tc utility, iproute2-ss040608

what i have forgot?

----------

## abali

Add a line containing "set -x" to the top of the script to see which command causes the error message.

----------

## Riveri

every one of "tc..." lines

```

+ DOWNLINK=800

+ UPLINK=220

+ DEV=eth1

+ NOPRIOHOSTSRC=80

+ NOPRIOHOSTDST=

+ NOPRIOPORTSRC=

+ NOPRIOPORTDST=

+ '[' '' = status ']'

+ tc qdisc del dev eth1 root

+ tc qdisc del dev eth1 ingress

+ '[' '' = stop ']'

+ tc qdisc add dev eth1 root handle 1: cbq avpkt 1000 bandwidth 10mbit

RTNETLINK answers: Invalid argument

+ tc class add dev eth1 parent 1: classid 1:1 cbq rate 220kbit allot 

1500 prio 5 bounded isolated

RTNETLINK answers: Invalid argument

+ tc class add dev eth1 parent 1:1 classid 1:10 cbq rate 220kbit allot 

1600 prio 1 avpkt 1000

RTNETLINK answers: Invalid argument

+ tc class add dev eth1 parent 1:1 classid 1:20 cbq rate 198kbit allot 

1600 prio 2 avpkt 1000

RTNETLINK answers: Invalid argument

+ tc class add dev eth1 parent 1:1 classid 1:30 cbq rate 176kbit allot 

1600 prio 2 avpkt 1000

RTNETLINK answers: Invalid argument

+ tc qdisc add dev eth1 parent 1:10 handle 10: sfq perturb 10

RTNETLINK answers: Invalid argument

+ tc qdisc add dev eth1 parent 1:20 handle 20: sfq perturb 10

RTNETLINK answers: Invalid argument

+ tc qdisc add dev eth1 parent 1:30 handle 30: sfq perturb 10

RTNETLINK answers: Invalid argument

+ tc filter add dev eth1 parent 1:0 protocol ip prio 10 u32 match ip tos 

0x10 0xff flowid 1:10

RTNETLINK answers: Invalid argument

+ tc filter add dev eth1 parent 1:0 protocol ip prio 11 u32 match ip 

protocol 1 0xff flowid 1:10

RTNETLINK answers: Invalid argument

+ tc filter add dev eth1 parent 1: protocol ip prio 12 u32 match ip 

protocol 6 0xff match u8 0x05 0x0f at 0 match u16 0x0000 0xffc0 at 2 

flowid 1:10

RTNETLINK answers: Invalid argument

+ tc filter add dev eth1 parent 1: protocol ip prio 16 u32 match ip src 

80 flowid 1:30

RTNETLINK answers: Invalid argument

+ tc filter add dev eth1 parent 1: protocol ip prio 18 u32 match ip dst 

0.0.0.0/0 flowid 1:20

RTNETLINK answers: Invalid argument

+ tc qdisc add dev eth1 handle ffff: ingress

RTNETLINK answers: Invalid argument

+ tc filter add dev eth1 parent ffff: protocol ip prio 50 u32 match ip 

src 0.0.0.0/0 police rate 800kbit burst 10k drop flowid :1

RTNETLINK answers: Invalid argument
```

Last edited by Riveri on Thu Sep 30, 2004 7:59 pm; edited 1 time in total

----------

## abali

Do you have Netlink support enabled? (CONFIG_NETLINK_DEV)

----------

## abali

Anyway, try these for the network settings:

```
CONFIG_NET=y

CONFIG_PACKET=y

CONFIG_NETLINK_DEV=m

CONFIG_UNIX=y

CONFIG_NET_KEY=y

CONFIG_INET=y

CONFIG_IP_MULTICAST=y

CONFIG_IP_ADVANCED_ROUTER=y

CONFIG_IP_MULTIPLE_TABLES=y

CONFIG_IP_ROUTE_FWMARK=y

CONFIG_IP_ROUTE_MULTIPATH=y

CONFIG_IP_ROUTE_TOS=y

CONFIG_IP_ROUTE_VERBOSE=y

CONFIG_NET_IPIP=m

CONFIG_NET_IPGRE=m

CONFIG_ARPD=y

CONFIG_SYN_COOKIES=y

CONFIG_INET_AH=m

CONFIG_INET_ESP=m

CONFIG_INET_IPCOMP=m

CONFIG_INET_TUNNEL=m

CONFIG_IP_VS=m

CONFIG_IP_VS_TAB_BITS=12

CONFIG_IP_VS_PROTO_TCP=y

CONFIG_IP_VS_PROTO_UDP=y

CONFIG_IP_VS_PROTO_ESP=y

CONFIG_IP_VS_PROTO_AH=y

CONFIG_IP_VS_RR=m

CONFIG_IP_VS_WRR=m

CONFIG_IP_VS_LC=m

CONFIG_IP_VS_WLC=m

CONFIG_IP_VS_LBLC=m

CONFIG_IP_VS_LBLCR=m

CONFIG_IP_VS_DH=m

CONFIG_IP_VS_SH=m

CONFIG_IP_VS_SED=m

CONFIG_IP_VS_NQ=m

CONFIG_IP_VS_FTP=m

CONFIG_NETFILTER=y

CONFIG_IP_NF_CONNTRACK=m

CONFIG_IP_NF_CT_ACCT=y

CONFIG_IP_NF_CT_PROTO_SCTP=m

CONFIG_IP_NF_FTP=m

CONFIG_IP_NF_IRC=m

CONFIG_IP_NF_TFTP=m

CONFIG_IP_NF_AMANDA=m

CONFIG_IP_NF_QUEUE=m

CONFIG_IP_NF_IPTABLES=m

CONFIG_IP_NF_MATCH_LIMIT=m

CONFIG_IP_NF_MATCH_IPRANGE=m

CONFIG_IP_NF_MATCH_MAC=m

CONFIG_IP_NF_MATCH_PKTTYPE=m

CONFIG_IP_NF_MATCH_MARK=m

CONFIG_IP_NF_MATCH_MULTIPORT=m

CONFIG_IP_NF_MATCH_TOS=m

CONFIG_IP_NF_MATCH_RECENT=m

CONFIG_IP_NF_MATCH_ECN=m

CONFIG_IP_NF_MATCH_DSCP=m

CONFIG_IP_NF_MATCH_AH_ESP=m

CONFIG_IP_NF_MATCH_LENGTH=m

CONFIG_IP_NF_MATCH_TTL=m

CONFIG_IP_NF_MATCH_TCPMSS=m

CONFIG_IP_NF_MATCH_HELPER=m

CONFIG_IP_NF_MATCH_STATE=m

CONFIG_IP_NF_MATCH_CONNTRACK=m

CONFIG_IP_NF_MATCH_OWNER=m

CONFIG_IP_NF_MATCH_ADDRTYPE=m

CONFIG_IP_NF_MATCH_REALM=m

CONFIG_IP_NF_MATCH_SCTP=m

CONFIG_IP_NF_FILTER=m

CONFIG_IP_NF_TARGET_REJECT=m

CONFIG_IP_NF_TARGET_LOG=m

CONFIG_IP_NF_TARGET_ULOG=m

CONFIG_IP_NF_TARGET_TCPMSS=m

CONFIG_IP_NF_NAT=m

CONFIG_IP_NF_NAT_NEEDED=y

CONFIG_IP_NF_TARGET_MASQUERADE=m

CONFIG_IP_NF_TARGET_REDIRECT=m

CONFIG_IP_NF_TARGET_NETMAP=m

CONFIG_IP_NF_TARGET_SAME=m

CONFIG_IP_NF_NAT_LOCAL=y

CONFIG_IP_NF_NAT_SNMP_BASIC=m

CONFIG_IP_NF_NAT_IRC=m

CONFIG_IP_NF_NAT_FTP=m

CONFIG_IP_NF_NAT_TFTP=m

CONFIG_IP_NF_NAT_AMANDA=m

CONFIG_IP_NF_MANGLE=m

CONFIG_IP_NF_TARGET_TOS=m

CONFIG_IP_NF_TARGET_ECN=m

CONFIG_IP_NF_TARGET_DSCP=m

CONFIG_IP_NF_TARGET_MARK=m

CONFIG_IP_NF_TARGET_CLASSIFY=m

CONFIG_IP_NF_RAW=m

CONFIG_IP_NF_TARGET_NOTRACK=m

CONFIG_IP_NF_ARPTABLES=m

CONFIG_IP_NF_ARPFILTER=m

CONFIG_IP_NF_ARP_MANGLE=m

CONFIG_XFRM=y

CONFIG_XFRM_USER=m

CONFIG_NET_SCHED=y

CONFIG_NET_SCH_CLK_JIFFIES=y

CONFIG_NET_SCH_CBQ=m

CONFIG_NET_SCH_HTB=m

CONFIG_NET_SCH_HFSC=m

CONFIG_NET_SCH_PRIO=m

CONFIG_NET_SCH_RED=m

CONFIG_NET_SCH_SFQ=m

CONFIG_NET_SCH_TEQL=m

CONFIG_NET_SCH_TBF=m

CONFIG_NET_SCH_GRED=m

CONFIG_NET_SCH_DSMARK=m

CONFIG_NET_SCH_NETEM=m

CONFIG_NET_SCH_INGRESS=m

CONFIG_NET_QOS=y

CONFIG_NET_ESTIMATOR=y

CONFIG_NET_CLS=y

CONFIG_NET_CLS_TCINDEX=m

CONFIG_NET_CLS_ROUTE4=m

CONFIG_NET_CLS_ROUTE=y

CONFIG_NET_CLS_FW=m

CONFIG_NET_CLS_U32=m

CONFIG_NET_CLS_RSVP=m

CONFIG_NET_CLS_POLICE=y

CONFIG_NET_PKTGEN=m

CONFIG_NETDEVICES=y

CONFIG_DUMMY=m

CONFIG_BONDING=m

CONFIG_EQUALIZER=m

CONFIG_TUN=m
```

----------

## Riveri

netlink didnt do any difference.... next im trying that your kernel conf...

----------

## abali

The script works here (with the config above), but still I'd recommend using HTB instead of CBQ. You can find the HTB version of the wondershaper script here.

----------

## Riveri

```

+ DOWNLINK=800

+ UPLINK=220

+ DEV=eth1

+ tc qdisc del dev eth1 root

+ tc qdisc del dev eth1 ingress

+ tc qdisc add dev eth1 root handle 1: htb default 20

RTNETLINK answers: Invalid argument

+ tc class add dev eth1 parent 1: classid 1:1 htb rate 220kbit burst

Command line is not complete. Try option "help"

+ 6k

./wshaper: line 28: 6k: command not found

+ tc class add dev eth1 parent 1:1 classid 1:10 htb rate 220kbit burst 6k prio 1

RTNETLINK answers: Invalid argument

+ tc class add dev eth1 parent 1:1 classid 1:20 htb rate

Command line is not complete. Try option "help"

+ 198kbit burst 6k prio 2

./wshaper: line 40: 198kbit: command not found

+ tc qdisc add dev eth1 parent 1:10 handle 10: sfq perturb 10

RTNETLINK answers: Invalid argument

+ tc qdisc add dev eth1 parent 1:20 handle 20: sfq perturb 10

RTNETLINK answers: Invalid argument

+ tc filter add dev eth1 parent 1:0 protocol ip prio 10 u32 match ip tos 0x10 0x             

ff flowid 1:10

RTNETLINK answers: Invalid argument

+ tc filter add dev eth1 parent 1:0 protocol ip prio 10 u32 match ip protocol 1              

0xff flowid 1:10

RTNETLINK answers: Invalid argument

+ tc filter add dev eth1 parent 1: protocol ip prio 10 u32 match ip protocol 6 0             

xff match u8 0x05 0x0f at 0 match u16 0x0000 0xffc0 at 2 match u8 0x10 0xff at 3             

3 flowid 1:10

RTNETLINK answers: Invalid argument

+ tc qdisc add dev eth1 handle ffff: ingress

RTNETLINK answers: Invalid argument

+ tc filter add dev eth1 parent ffff: protocol ip prio 50 u32 match ip src

Illegal "match"

+ 0.0.0.0/0 police rate 800kbit burst 10k drop flowid :1

./wshaper: line 82: 0.0.0.0/0: No such file or directory

```

this with your kernel conf and HTB...

----------

## Riveri

i have also tried 3 different iproute2 versions, but didnt help eather

----------

## abali

Interesting. Fix the line wraps in the HTB script first. I'm using iproute2-ss040831.

----------

## Riveri

```

+ DOWNLINK=800

+ UPLINK=220

+ DEV=eth1

+ tc qdisc del dev eth1 root

+ tc qdisc del dev eth1 ingress

+ tc qdisc add dev eth1 root handle 1: htb default 20

RTNETLINK answers: Invalid argument

+ tc class add dev eth1 parent 1: classid 1:1 htb rate 220kbit burst 6k

RTNETLINK answers: Invalid argument

+ tc class add dev eth1 parent 1:1 classid 1:10 htb rate 220kbit burst 6k prio 1

RTNETLINK answers: Invalid argument

+ tc class add dev eth1 parent 1:1 classid 1:20 htb rate 198kbit burst 6k prio 2

RTNETLINK answers: Invalid argument

+ tc qdisc add dev eth1 parent 1:10 handle 10: sfq perturb 10

RTNETLINK answers: Invalid argument

+ tc qdisc add dev eth1 parent 1:20 handle 20: sfq perturb 10

RTNETLINK answers: Invalid argument

+ tc filter add dev eth1 parent 1:0 protocol ip prio 10 u32 match ip tos 0x10 0xff flowid 1:10

RTNETLINK answers: Invalid argument

We have an error talking to the kernel

+ tc filter add dev eth1 parent 1:0 protocol ip prio 10 u32 match ip protocol 1 0xff flowid 1:10

RTNETLINK answers: Invalid argument

We have an error talking to the kernel

+ tc filter add dev eth1 parent 1: protocol ip prio 10 u32 match ip protocol 6 0xff match u8 0x05 0x0f at 0 match u16 0x0000 0xffc0 at 2 match 

u8 0x10 0xff at 33 flowid 1:10

RTNETLINK answers: Invalid argument

We have an error talking to the kernel

+ tc qdisc add dev eth1 handle ffff: ingress

RTNETLINK answers: Invalid argument

+ tc filter add dev eth1 parent ffff: protocol ip prio 50 u32 match ip src 0.0.0.0/0 police rate 800kbit burst 10k drop flowid :1

RTNETLINK answers: Invalid argument

We have an error talking to the kernel

```

changed the iproute2 to same version what you have...

error msg changed little...

but this part was interesting...

```

root@rave rave # lsmod                                                         

Module                  Size  Used by

fglrx                 206852  - 

ipw2200                92364  - 

firmware_class          6792  - 

ieee80211              15116  - 

ieee80211_crypt         3884  - 

root@rave rave # modprobe sch_ingress                                                       

FATAL: Error inserting sch_ingress 

(/lib/modules/2.6.9-rc2/kernel/net/sched/sch_ingress.ko): Unknown symbol in module, 

or unknown parameter (see dmesg)

---from dmesg---

sch_ingress: Unknown symbol unregister_qdisc

sch_ingress: Unknown symbol register_qdisc

---from dmesg---

```

so have you load those modules or what ?

----------

## abali

No, the modules are supposed to be loaded automatically when needed. I think we've got something here. Do you get any output if you try "depmod -a" ? register_qdisc/unregister_qdisc should be defined if CONFIG_NET_SCHED is enabled. You could also try an other kernel.

----------

## Riveri

I would rather stay in this kernel, cause i didnt get my cpu:s speedfreq to work with older kernels (im using centrino laptop)

depmod -a didnt give any output

and CONFIG_NET_SCHED=y

----------

## abali

Do you have a System.map file for the kernel you're running? What output does "grep register_qdisc System.map" give? Also, do you get this error message if you try eg. "modprobe sch_htb" ?

----------

## Riveri

```

root@rave linux # grep register_qdisc System.map                               

c038ee68 T register_qdisc

c038eefa T unregister_qdisc

c0458e30 r __ksymtab_register_qdisc

c0458e38 r __ksymtab_unregister_qdisc

c04656fa r __kstrtab_register_qdisc

c0465709 r __kstrtab_unregister_qdisc

root@rave linux # modprobe sch_htb                                             

FATAL: Error inserting sch_htb 

(/lib/modules/2.6.9-rc2/kernel/net/sched/sch_htb.ko): Unknown symbol in 

module, or unknown parameter (see dmesg)

--from dmesg---

sch_htb: Unknown symbol qdisc_put_rtab

sch_htb: Unknown symbol unregister_qdisc

sch_htb: Unknown symbol pfifo_qdisc_ops

sch_htb: Unknown symbol register_qdisc

sch_htb: Unknown symbol qdisc_kill_estimator

sch_htb: Unknown symbol qdisc_get_rtab

```

----------

## abali

Wow, something is seriously f*cked up. The kernel image is supposed to contain the functions but these functions are not found when a module tries to call them. You sure that you have rebooted with the new bzImage after compiling CONFIG_NET_SCHED into the kernel, not the old? Also, what does "grep register_qdisc /proc/kallsyms" say?

----------

## Riveri

yep, i have rebooted with the new bzimage

grep register_qdisc /proc/kallsyms doesnt say anything

----------

## Riveri

i guess i have to try another kernel...

but i leave it for tomorrow, now i have to go to sleep (my french classes starts in 7hours)

----------

## abali

Yeah that's the best I could suggest now.  :Smile:  I'm out of ideas. The only possible scenario I could imagine is that the kernel image you are running right now is not the one that has the scheduling support compiled in, but since you are sure that it is, I cannot say anything more. Trying another kernel is a good idea though.

----------

## Riveri

ok.. this really aint iproute2 problem anymore, but i continue to this...

when i run my wshaper script

```

+ tc qdisc add dev eth1 root handle 1: htb default 10

+ tc class add dev eth1 parent 1: classid 1:1 htb rate 450kbit burst 6k

+ tc class add dev eth1 parent 1:1 classid 1:10 htb rate 450kbit burst 

6k prio 1

+ tc class add dev eth1 parent 1:1 classid 1:20 htb rate 200kbit burst 

6k prio 2

+ tc class add dev eth1 parent 1:1 classid 1:30 htb rate 40kbit burst 6k 

prio 3

+ tc qdisc add dev eth1 parent 1:10 handle 10: sfq perturb 10

+ tc qdisc add dev eth1 parent 1:20 handle 20: sfq perturb 10

+ tc qdisc add dev eth1 parent 1:30 handle 30: sfq perturb 10

+ iptables -t mangle -A OUTPUT -m owner --cmd-owner wineserver -j MARK 

--set-mark 2

iptables: Invalid argument

+ tc filter add dev eth1 protocol ip parent 1:0 handle 2 fw flowid 1:30

RTNETLINK answers: Invalid argument

We have an error talking to the kernel

```

--cmd-owner makes the error

and i have compiled it to kernel

CONFIG_IP_NF_MATCH_OWNER=y

dmesg says this after trying to run the script

```

ipt_owner: pid, sid and command matching is broken on SMP.

```

----------

## abali

Well, as it says, the "owner" matching of iptables will not work on an SMP-enabled kernel.

----------

## Riveri

i just dont no what SMP-enabled kernel is...

anyway...

this might be stupid question, but... 

you wrote like this in your HOWTO

```

$ tc filter add dev eth0 parent 1: protocol ip u32 match ip sport 80 0xffff flowid 1:20

```

how can i limit several ports with one command ? Like ports 31000-33000 etc.

----------

## abali

 *Riveri wrote:*   

> i just dont no what SMP-enabled kernel is...

 

In your kernel config, Processor type and features -> Symmetric multi-processing support should be unchecked unless you really need it (ie. have 2 or more CPUs).

 *Riveri wrote:*   

> 
> 
> anyway...
> 
> this might be stupid question, but... 
> ...

 

AFAIK you can match only one port in one filter, so you'll either have to add 2 thousand filters (which is absolutely not recommended), or use iptables to mark a port range and then tc to match on that mark. Example:

```
$ iptables -t mangle -A OUTPUT -p tcp --sport 31000:33000 -j MARK --set-mark 5

$ tc filter add dev eth0 protocol ip parent 1:0 handle 5 fw flowid 1:20
```

----------

## Riveri

ok... thanks... you have been more than helpful

I think i have now got everything work in my laptop like i wish

----------

