Hello to the list.

I would like to submit a patch against current git repo.
The first part corrects a double hexadecimal encoding of the same
variable.

        my $devicenumber  = in_hexp $devref->{number};
                            ^^^^^^^
        my $classid  = join( ':', in_hexp $devicenumber, $classnum);
                                  ^^^^^^^
The second part replaces $devref->{number} by $devicenumber, which must
be hex encoded in tc sentences.

With these changes I was able to correctly compile and run shorewall
with 10+ devices with shaping (tcdevices, tcrules and tcclasses filled).

Before that I had errors like this one :

Argument "a" isn't numeric in sprintf at
/usr/share/shorewall/Shorewall/Config.pm line 893.

When looking at the generated script, what we had in tc was : 

    if interface_is_up eth0.508; then
        eth0_508_exists=Yes
        qt $TC qdisc del dev eth0.508 root
        qt $TC qdisc del dev eth0.508 ingress
        eth0_508_mtu=$(get_device_mtu eth0.508)
        eth0_508_mtu1=$(get_device_mtu1 eth0.508)
        run_tc qdisc add dev eth0.508 root handle a: htb default 109 r2q
5000
        run_tc class add dev eth0.508 parent a: classid a:1 htb rate
1000000kbit $eth0_508_mtu1
        run_tc qdisc add dev eth0.508 handle ffff: ingress
        run_tc filter add dev eth0.508 parent ffff: protocol all prio 10
u32 match ip src 0.0.0.0/0 police rate 1000000kbit burst 10kb drop
flowid :1
        progress_message "   TC Device eth0.508 defined."
    else
        error_message "WARNING: Device eth0.508 is not in the UP state
-- traffic-shaping configuration skipped"
        eth0_508_exists=
    fi

10th interface -> 0xa : ok, up to here no errors.

And after that, 

    if [ -n "$eth0_508_exists" ]; then
        [ $eth0_508_mtu -gt 24 ] && quantum=$eth0_508_mtu || quantum=24
        run_tc class add dev eth0.508 parent 10:1 classid 0:109 htb rate
999kbit ceil 1001kbit prio 1 $eth0_508_mtu1 quantum $quantum
        run_tc qdisc add dev eth0.508 parent 0:109 handle 26: sfq
quantum $quantum limit 127 perturb 10
        run_tc filter add dev eth0.508 protocol all parent a:0 prio 276
handle 9 fw classid 0:109
        progress_message "   TC Class 0:109 defined."

    fi

Here we have two errors : 
- parent device numer -> "10" instead of "a" in the tc class
- classid -> "0" both in the class and the qdisc, which is obviously
wrong ("a" is not a number and thus cannot be converted from decimal to
hex => result=0). This is the error triggered on line 893.

The attached patch corrects these two errors and shows the correct
behaviour.

Hope it helps.

Thanks for this good product.

Sydney.

Attachment: Tc.patch
Description: Tc.patch

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Shorewall-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shorewall-devel

Reply via email to