[ovs-dev] [PATCH 3/3] ARP packets must have print arp_tpa/arp_spa instead of nw_dst/nw_src.

Ethan Jackson ethan at nicira.com
Sat Oct 20 17:50:55 UTC 2012


Thanks for doing this,

Acked-by: Ethan Jackson <ethan at nicira.com>


On Wed, Oct 17, 2012 at 6:23 PM, Mehak Mahajan <mmahajan at nicira.com> wrote:
> With a previous commit 953cc1888321346e6c4175fbc0a3f66d34913ea3, the
> ovs logs were re-formatted such that they can be input into the
> ofproto/trace.  For ARP packets, ofproto/trace expects arp_tpa/arp_spa
> instead of nw_dst/nw_src.
>
> Signed-off-by: Mehak Mahajan <mmahajan at nicira.com>
> ---
>  lib/match.c        |    3 +++
>  tests/ofp-print.at |   22 +++++++++++-----------
>  tests/ovs-ofctl.at |   12 ++++++------
>  3 files changed, 20 insertions(+), 17 deletions(-)
>
> diff --git a/lib/match.c b/lib/match.c
> index e53a11a..6a4fec7 100644
> --- a/lib/match.c
> +++ b/lib/match.c
> @@ -780,6 +780,9 @@ match_format(const struct match *match, struct ds *s, unsigned int priority)
>                                ntohl(wc->masks.ipv6_label));
>              }
>          }
> +    } else if (f->dl_type == htons(ETH_TYPE_ARP)) {
> +        format_ip_netmask(s, "arp_spa", f->nw_src, wc->masks.nw_src);
> +        format_ip_netmask(s, "arp_tpa", f->nw_dst, wc->masks.nw_dst);
>      } else {
>          format_ip_netmask(s, "nw_src", f->nw_src, wc->masks.nw_src);
>          format_ip_netmask(s, "nw_dst", f->nw_dst, wc->masks.nw_dst);
> diff --git a/tests/ofp-print.at b/tests/ofp-print.at
> index 0fe2eff..dff7bf4 100644
> --- a/tests/ofp-print.at
> +++ b/tests/ofp-print.at
> @@ -365,7 +365,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
>  30 e0 35 00 00 05 00 00 00 00 00 00 00 00 00 01 \
>  00 00 00 00 00 00 00 3c \
>  "], [0], [dnl
> -OFPT_FLOW_REMOVED (xid=0x0): priority=65535,arp,in_port=3,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,arp_op=2,nw_tos=0,tp_src=0,tp_dst=0 reason=idle duration5.82s idle5 pkts1 bytes60
> +OFPT_FLOW_REMOVED (xid=0x0): priority=65535,arp,in_port=3,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,nw_tos=0,tp_src=0,tp_dst=0 reason=idle duration5.82s idle5 pkts1 bytes60
>  ])
>  AT_CLEANUP
>
> @@ -452,11 +452,11 @@ AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' ofp-print "\
>  00 00 00 00 00 00 00 00 00 00 00 05 00 00 00 00 \
>  00 00 01 0e 00 00 00 00 00 00 00 08 00 03 00 00 \
>  " 2], [0], [dnl
> -OFPT_FLOW_MOD (xid=0x0): ADD priority=65535,arp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,arp_op=2 idle:5 buf:0x10e out_port:0 actions=output:3
> +OFPT_FLOW_MOD (xid=0x0): ADD priority=65535,arp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2 idle:5 buf:0x10e out_port:0 actions=output:3
>  ], [dnl
>  ofp_util|INFO|normalization changed ofp_match, details:
> -ofp_util|INFO| pre: arp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,arp_op=2,nw_tos=0,tp_src=0,tp_dst=0
> -ofp_util|INFO|post: arp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,arp_op=2
> +ofp_util|INFO| pre: arp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2,nw_tos=0,tp_src=0,tp_dst=0
> +ofp_util|INFO|post: arp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2
>  ])
>  AT_CLEANUP
>
> @@ -474,7 +474,7 @@ ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
>  00 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
>  00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
>  " 2], [0], [dnl
> -OFPT_FLOW_MOD (OF1.2) (xid=0x2): ADD table:255 priority=65535,arp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,arp_op=2 actions=output:3
> +OFPT_FLOW_MOD (OF1.2) (xid=0x2): ADD table:255 priority=65535,arp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2 actions=output:3
>  ], [dnl
>  ])
>  AT_CLEANUP
> @@ -493,8 +493,8 @@ AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' ofp-print "\
>  OFPT_FLOW_MOD (xid=0x0): ADD arp,in_port=1,dl_vlan=65535,dl_vlan_pcp=0,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,arp_op=2,nw_tos=0,tp_src=0,tp_dst=0 idle:5 pri:65535 buf:0x10e out_port:0 actions=output:3
>  ], [dnl
>  ofp_util|INFO|normalization changed ofp_match, details:
> -ofp_util|INFO| pre: arp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,arp_op=2,nw_tos=0,tp_src=0,tp_dst=0
> -ofp_util|INFO|post: arp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,arp_op=2
> +ofp_util|INFO| pre: arp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2,nw_tos=0,tp_src=0,tp_dst=0
> +ofp_util|INFO|post: arp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2
>  ])
>  AT_CLEANUP
>
> @@ -512,7 +512,7 @@ ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
>  00 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
>  00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
>  " 2], [0], [dnl
> -OFPT_FLOW_MOD (OF1.2) (xid=0x2): ADD table:255 priority=65535,arp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,arp_op=2 actions=output:3
> +OFPT_FLOW_MOD (OF1.2) (xid=0x2): ADD table:255 priority=65535,arp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2 actions=output:3
>  ], [dnl
>  ])
>  AT_CLEANUP
> @@ -769,9 +769,9 @@ c0 a8 00 02 00 08 00 00 00 00 00 09 05 b8 d8 00 \
>  00 00 00 00 00 00 00 00 \
>  "], [0], [dnl
>  OFPST_FLOW reply (xid=0x4):
> - cookie=0x0, duration=4.2s, table=0, n_packets=1, n_bytes=60, idle_timeout=5, priority=65535,arp,in_port=3,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,arp_op=2,nw_tos=0,tp_src=0,tp_dst=0 actions=output:1
> + cookie=0x0, duration=4.2s, table=0, n_packets=1, n_bytes=60, idle_timeout=5, priority=65535,arp,in_port=3,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,nw_tos=0,tp_src=0,tp_dst=0 actions=output:1
>   cookie=0x0, duration=8.9s, table=0, n_packets=13, n_bytes=1274, idle_timeout=5, priority=65535,icmp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,nw_tos=0,icmp_type=0,icmp_code=0 actions=output:3
> - cookie=0x0, duration=4.28s, table=0, n_packets=1, n_bytes=60, idle_timeout=5, priority=65535,arp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,arp_op=1,nw_tos=0,tp_src=0,tp_dst=0 actions=output:3
> + cookie=0x0, duration=4.28s, table=0, n_packets=1, n_bytes=60, idle_timeout=5, priority=65535,arp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=1,nw_tos=0,tp_src=0,tp_dst=0 actions=output:3
>   cookie=0x0, duration=9.096s, table=0, n_packets=13, n_bytes=1274, idle_timeout=5, icmp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,icmp_type=8,icmp_code=0 actions=output:1
>   cookie=0x0, duration=0s, table=2, n_packets=0, n_bytes=0, actions=drop
>  ])
> @@ -1269,7 +1269,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
>  1e 02 00 02 00 00 20 04 c0 a8 00 01 00 00 22 04 \
>  c0 a8 00 02 00 00 00 00 \
>  "], [0], [dnl
> -NXT_FLOW_REMOVED (xid=0x0): priority=65535,arp,in_port=3,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,arp_op=2 reason=idle duration6.024s idle5 pkts1 bytes60
> +NXT_FLOW_REMOVED (xid=0x0): priority=65535,arp,in_port=3,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2 reason=idle duration6.024s idle5 pkts1 bytes60
>  ])
>  AT_CLEANUP
>
> diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at
> index 8185827..08a4c46 100644
> --- a/tests/ovs-ofctl.at
> +++ b/tests/ovs-ofctl.at
> @@ -838,20 +838,20 @@ xxxxxxxx c0a88055 xxxx xxxx
>  003220ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx xx xxxx dnl
>  xxxxxxxx c0a88055 xxxx xxxx
>
> -# arp,nw_src=192.168.128.85
> +# arp,arp_spa=192.168.128.85
>  003800ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl
>  c0a88055 xxxxxxxx xxxx xxxx
>
> -# arp,nw_src=192.168.128.0/24
> +# arp,arp_spa=192.168.128.0/24
>  # 31: 55 -> 00
>  003808ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl
>  c0a88055 xxxxxxxx xxxx xxxx
>
> -# arp,nw_dst=192.168.128.85
> +# arp,arp_tpa=192.168.128.85
>  003020ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl
>  xxxxxxxx c0a88055 xxxx xxxx
>
> -# arp,nw_dst=192.168.128.0/24
> +# arp,arp_tpa=192.168.128.0/24
>  # 35: 55 -> 00
>  003220ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl
>  xxxxxxxx c0a88055 xxxx xxxx
> @@ -1107,13 +1107,13 @@ dnl Try invalid TOS:
>  0000 00 00 0800 00 00 00000000ffffffff c0a880005a5a5a5a 0000 0000 dnl
>  00000000 00 000000 0000000000000000ffffffffffffffff
>
> -# arp,nw_src=192.168.128.0/24
> +# arp,arp_spa=192.168.128.0/24
>  0000 0058 00000000 000003f7 dnl
>  000000000000ffffffffffff 000000000000ffffffffffff dnl
>  0000 00 00 0806 00 00 c0a88000000000ff 00000000ffffffff 0000 0000 dnl
>  00000000 00 000000 0000000000000000ffffffffffffffff
>
> -# arp,nw_dst=192.168.128.0/24
> +# arp,arp_tpa=192.168.128.0/24
>  0000 0058 00000000 000003f7 dnl
>  000000000000ffffffffffff 000000000000ffffffffffff dnl
>  0000 00 00 0806 00 00 00000000ffffffff c0a88000000000ff 0000 0000 dnl
> --
> 1.7.2.5
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list