If verbosity parameter of ofp_print_packet_in() is greater than 2 then output a hexdump of PACKET_IN packets as well as the output of ofp_packet_to_string(), which is shown if verbosity is greater than 0.
The motivation of this is to allow tests to be written that use ovs-ofctl -m monitor to check packet data which is not output by ofp_packet_to_string(). Specifically, as the protocol of the inner-packet is not known by ofp_packet_to_string() it only decodes and stringifies an MPLS packet up to and including the first MPLS label stack entry. However it may be useful to create tests which verify the contents of the inner packet. One example may be verify the effect of dec_ttl in the following sequence of actions applied to a packet with a single MPLS label stack entry. pop_mpls(0x800),dec_ttl,push_mpls(0x8847) An example of the ovs-ofctl -m monitor output, is as follows: NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered) mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:04:10,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=253,mpls_bos=1 00000000 50 54 00 00 00 07 60 66-66 66 04 10 88 48 00 00 00000010 01 fd 45 00 00 2c 00 00-00 00 ff 06 3a 78 c0 a8 00000020 00 01 c0 a8 00 02 00 50-00 00 00 00 00 2a 00 00 00000030 00 2a 50 00 27 10 77 44-00 00 48 4f 47 45 Without the -m flag the hex dump is not shown, this is consistent with the behaviour prior to this patch. For consistency a similar change could trivially be made for PACKET_OUT. Signed-off-by: Simon Horman <ho...@verge.net.au> --- lib/ofp-print.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ofp-print.c b/lib/ofp-print.c index 8d99844..1c0dd49 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -151,6 +151,9 @@ ofp_print_packet_in(struct ds *string, const struct ofp_header *oh, ds_put_cstr(string, packet); free(packet); } + if (verbosity > 2) { + ds_put_hex_dump(string, pin.packet, pin.packet_len, 0, false); + } } static void -- 1.8.2.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev