mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
nsh: Add support to compose-packet and use it in system tests.
OVS can parse NSH, but can't compose. Fix that and get rid of plain hex NSH packets in system tests as they are hard to read or modify. Tcpdump calls modified to write actual pcaps instead of text output, so ovs-pcap can be used while checking the results. While at it, replacing sleeps with more robust waiting for tcpdump to start listening. M4 macros are better than shell variables, because we can see the substitution result in the test log. So, using m4_define and m4_join extensively. Acked-by: Simon Horman <horms@ovn.org> Acked-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
18
lib/flow.c
18
lib/flow.c
@@ -3420,6 +3420,24 @@ flow_compose(struct dp_packet *p, const struct flow *flow,
|
||||
arp->ar_sha = flow->arp_sha;
|
||||
arp->ar_tha = flow->arp_tha;
|
||||
}
|
||||
} else if (flow->dl_type == htons(ETH_TYPE_NSH)) {
|
||||
struct nsh_hdr *nsh;
|
||||
|
||||
nsh = dp_packet_put_zeros(p, sizeof *nsh);
|
||||
dp_packet_set_l3(p, nsh);
|
||||
|
||||
nsh_set_flags_ttl_len(nsh, flow->nsh.flags, flow->nsh.ttl,
|
||||
flow->nsh.mdtype == NSH_M_TYPE1
|
||||
? NSH_M_TYPE1_LEN : NSH_BASE_HDR_LEN);
|
||||
nsh->next_proto = flow->nsh.np;
|
||||
nsh->md_type = flow->nsh.mdtype;
|
||||
put_16aligned_be32(&nsh->path_hdr, flow->nsh.path_hdr);
|
||||
|
||||
if (flow->nsh.mdtype == NSH_M_TYPE1) {
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
put_16aligned_be32(&nsh->md1.context[i], flow->nsh.context[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (eth_type_mpls(flow->dl_type)) {
|
||||
|
Reference in New Issue
Block a user