#!/bin/bash

function pktgen {
    ../pktgen/pktgen_bench_xmit_mode_netif_receive.sh -i $IFC -s 64 \
        -m 90:e2:ba:ff:ff:ff -d 192.168.0.1 -t 4
    local dropped=`tc -s qdisc show dev $IFC | tail -3 | awk '/drop/{print $7}'`
    if [ "$dropped" == "0," ]; then
        echo "FAIL"
    else
        echo "Successfully filtered " $dropped " packets"
    fi
}

function test {
    echo -n "Loading bpf program '$2'... "
    tc qdisc add dev $IFC clsact
    tc filter add dev $IFC ingress bpf da obj $1 sec $2
    local status=$?
    if [ $status -ne 0 ]; then
        echo "FAIL"
    else
        echo "ok"
	pktgen
    fi
    tc qdisc del dev $IFC clsact
}

IFC=test_veth

ip link add name $IFC type veth peer name pair_$IFC
ip link set $IFC up
ip link set pair_$IFC up

test ./parse_simple.o simple
test ./parse_varlen.o varlen
test ./parse_ldabs.o ldabs
ip link del dev $IFC
fe1b378c8b88de3b9c34b'/><select name='h' onchange='this.form.submit();'>
<option value='emaclite-cleanup'>emaclite-cleanup</option>
<option value='master' selected='selected'>master</option>
<option value='nds-private-remove'>nds-private-remove</option>
<option value='packet-loop-back'>packet-loop-back</option>
<option value='packet-rx-pump-back'>packet-rx-pump-back</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>net-next plumbings</td><td class='sub right'>Tobias Klauser</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/linux/net-next.git/'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?id=8708ecf01d454607f15fe1b378c8b88de3b9c34b'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/net/hsr'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/net/hsr?id=8708ecf01d454607f15fe1b378c8b88de3b9c34b'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/net/hsr?id=8708ecf01d454607f15fe1b378c8b88de3b9c34b'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/net/hsr?id=8708ecf01d454607f15fe1b378c8b88de3b9c34b'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/net/hsr'>
<input type='hidden' name='id' value='8708ecf01d454607f15fe1b378c8b88de3b9c34b'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?id=8708ecf01d454607f15fe1b378c8b88de3b9c34b'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/net?id=8708ecf01d454607f15fe1b378c8b88de3b9c34b'>net</a>/<a href='/cgit.cgi/linux/net-next.git/log/net/hsr?id=8708ecf01d454607f15fe1b378c8b88de3b9c34b'>hsr</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/net/hsr?id=8708ecf01d454607f15fe1b378c8b88de3b9c34b&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>