On Tue, May 24, 2016 at 06:24:21PM -0400, Flaviof wrote:
> Hi folks,
> 
> I'm trying to write a simple script to generate a packet into an existing
> ovs interface (below). Instead of using "ovs-appctl ofproto/trace", I'm
> attempting "ovs-appctl netdev-dummy/receive" so I can generate the raw
> bytes, similar to what we have in the AT tests.
> 
> Is "netdev-dummy/receive" something that did not exist in 2.0.2?
> Any pointers on how one could use that functionality?
> Maybe I could do this from an ovs sandbox?

The dummy datapath is an OVS construct. You won't see dummy bridge and dummy
ports as linux netdev interfaces. It is not at all related to the dummy linux
driver.

If you want to inject packets using a different datapath, you can try OpenFlow
packet out, using ovs-ofctl packet-out.

Regards.
Cascardo.

> 
> Thanks,
> 
> -- flaviof
> 
> ---
> 
> [dell:ovsScripts.git] (master)$ lsmod | grep dummy
> 
> dummy                  16384  0
> 
> [dell:ovsScripts.git] (master)$
> 
> [dell:ovsScripts.git] (master)$ sudo ovs-vsctl show
> 
> c0006a18-e32c-44aa-9985-7641d61a74fc
> 
>     Bridge brtest
> 
>         Port brtest
> 
>             Interface brtest
> 
>                 type: internal
> 
>         Port "dummy0"
> 
>             Interface "dummy0"
> 
>     ovs_version: "2.0.2"
> 
> [dell:ovsScripts.git] (master)$
> 
> [dell:ovsScripts.git] (master)$ ip a s dev dummy0
> 
> 13: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue master
> ovs-system state UNKNOWN group default
> 
>     link/ether 00:01:02:03:04:05 brd ff:ff:ff:ff:ff:ff
> 
>     inet 192.168.55.254/24 scope global dummy0
> 
>        valid_lft forever preferred_lft forever
> 
>     inet6 fe80::d074:13ff:fe2f:26d3/64 scope link
> 
>        valid_lft forever preferred_lft forever
> 
> [dell:ovsScripts.git] (master)$
> 
> [dell:ovsScripts.git] (master)$
> 
> [dell:ovsScripts.git] (master)$ cat sendIcmp.sh
> 
> #!/bin/bash
> 
> 
> ip_to_hex() {
> 
>     printf "%02x%02x%02x%02x" "$@"
> 
> }
> 
> 
> test_ipv4_icmp_request() {
> 
>     local invif=$1 eth_src=$2 eth_dst=$3 ipv4_src=$4 ipv4_dst=$5
> icmpv4_code=$6
> 
>     shift; shift; shift; shift; shift; shift
> 
>     # This packet has bad checksums but logical L3 routing doesn't check.
> 
>     local hdrchksum=0000
> 
>     local icmp_seq=0001
> 
>     local icmp_ts=02bb445700000000  ; # May/24/16 16:35:14 EDT
> 
>     local
> icmp_data=000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607
>  ; # 48 bytes
> 
>     local icmp_payload=0800${hdrchksum}5fbf${icmp_seq}${icmp_ts}${icmp_data}
> 
>     local
> packet=${eth_dst}${eth_src}080045000054000040004001${hdrchksum}${ipv4_src}${ipv4_dst}0035111100080000${icmp_payload}
> 
>     sudo ovs-appctl netdev-dummy/receive $invif $packet
> 
> 
> 
> }
> 
> 
> eth_dst=000102030405
> eth_src=001122334455
> ip_src=$(ip_to_hex 192 168 50 33)
> ip_dst=$(ip_to_hex 192 168 55 254)
> 
> set -x
> 
> test_ipv4_icmp_request dummy0 $eth_src $eth_dst $ip_src $ip_dst
> 
> echo ok
> 
> 
> [dell:ovsScripts.git] (master)$
> 
> [dell:ovsScripts.git] (master)$ ./sendIcmp.sh
> 
> + test_ipv4_icmp_request dummy0 001122334455 000102030405 c0a83221 c0a837fe
> 
> + local invif=dummy0 eth_src=001122334455 eth_dst=000102030405
> ipv4_src=c0a83221 ipv4_dst=c0a837fe icmpv4_code=
> 
> + local hdrchksum=0000
> 
> + local icmp_seq=0001
> 
> + local icmp_ts=02bb445700000000
> 
> + local
> icmp_data=000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607
> 
> + local
> icmp_payload=080000005fbf000102bb445700000000000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607
> 
> + local
> packet=0001020304050011223344550800450000540000400040010000c0a83221c0a837fe0035111100080000080000005fbf000102bb445700000000000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607
> 
> + sudo ovs-appctl netdev-dummy/receive dummy0
> 0001020304050011223344550800450000540000400040010000c0a83221c0a837fe0035111100080000080000005fbf000102bb445700000000000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607
> 
> "netdev-dummy/receive" is not a valid command
> 
> ovs-appctl: ovs-vswitchd: server returned an error
> 
> + echo ok
> 
> ok
> 
> [dell:ovsScripts.git] (master)$

> _______________________________________________
> discuss mailing list
> discuss@openvswitch.org
> http://openvswitch.org/mailman/listinfo/discuss

_______________________________________________
discuss mailing list
discuss@openvswitch.org
http://openvswitch.org/mailman/listinfo/discuss

Reply via email to