[ovs-dev] [PATCH ovn 2/3] Introduce icmp6.frag_mtu action
Lorenzo Bianconi
lorenzo.bianconi at redhat.com
Tue Jul 7 14:45:46 UTC 2020
> On Fri, Jul 3, 2020 at 7:55 PM Lorenzo Bianconi <lorenzo.bianconi at redhat.com>
> wrote:
>
[...]
> >
>
> Looks like this was used for debugging and you forgot to clean it up ?
>
> And the compilation warning is because of this.
Ops..sorry about this, I will fix it in v2
>
>
>
> > + /* compute checksum and set correct mtu */
> > + ih->icmp6_base.icmp6_cksum = 0;
> > + uint32_t csum = packet_csum_pseudoheader6(dp_packet_l3(pkt_out));
> > + uint32_t size = (uint8_t *)dp_packet_tail(pkt_out) - (uint8_t
> > *)ih;
> > + ih->icmp6_base.icmp6_cksum = csum_finish(
> > + csum_continue(csum, ih, size));
> > + }
> >
> > pin->packet = dp_packet_data(pkt_out);
> > pin->packet_len = dp_packet_size(pkt_out);
> > diff --git a/include/ovn/actions.h b/include/ovn/actions.h
> > index 652873676..0f7f4cdb8 100644
> > --- a/include/ovn/actions.h
> > +++ b/include/ovn/actions.h
> > @@ -598,6 +598,10 @@ enum action_opcode {
> > * The actions, in OpenFlow 1.3 format, follow the action_header.
> > */
> > ACTION_OPCODE_ICMP6_ERROR,
> > +
> > + /* MTU value (to put in the icmp6 header field - frag_mtu) follow the
> > + * action header. */
> > + ACTION_OPCODE_PUT_ICMP6_FRAG_MTU,
> > };
> >
> > /* Header. */
> > diff --git a/include/ovn/logical-fields.h b/include/ovn/logical-fields.h
> > index c7bd2dba9..25ef19c5e 100644
> > --- a/include/ovn/logical-fields.h
> > +++ b/include/ovn/logical-fields.h
> > @@ -108,6 +108,13 @@ enum ovn_field_id {
> > * packet as per the RFC 1191.
> > */
> > OVN_ICMP4_FRAG_MTU,
> > + /*
> > + * Name: "icmp6.frag_mtu" -
> > + * Type: be32
> > + * Description: Sets the low-order 16 bits of the ICMP6 header field
> > + * of the ICMP6 packet
> >
>
> The description seems to be wrong. It sets the 32-bit but it says 16-bits
> field.
yes, I will fix it in v2
Regards,
Lorenzo
>
>
>
> > + */
> > + OVN_ICMP6_FRAG_MTU,
> >
> > OVN_FIELD_N_IDS
> > };
> > diff --git a/lib/actions.c b/lib/actions.c
> > index 6a3b1ba87..e14907e3d 100644
> > --- a/lib/actions.c
> > +++ b/lib/actions.c
> > @@ -3056,6 +3056,7 @@ format_OVNFIELD_LOAD(const struct ovnact_load *load
> > , struct ds *s)
> > const struct ovn_field *f =
> > ovn_field_from_name(load->dst.symbol->name);
> > switch (f->id) {
> > case OVN_ICMP4_FRAG_MTU:
> > + case OVN_ICMP6_FRAG_MTU:
> > ds_put_format(s, "%s = %u;", f->name,
> > ntohs(load->imm.value.be16_int));
> > break;
> > @@ -3075,12 +3076,20 @@ encode_OVNFIELD_LOAD(const struct ovnact_load
> > *load,
> > switch (f->id) {
> > case OVN_ICMP4_FRAG_MTU: {
> > size_t oc_offset = encode_start_controller_op(
> > - ACTION_OPCODE_PUT_ICMP4_FRAG_MTU, true, NX_CTLR_NO_METER,
> > - ofpacts);
> > + ACTION_OPCODE_PUT_ICMP4_FRAG_MTU, true,
> > + NX_CTLR_NO_METER, ofpacts);
> > ofpbuf_put(ofpacts, &load->imm.value.be16_int, sizeof(ovs_be16));
> > encode_finish_controller_op(oc_offset, ofpacts);
> > break;
> > }
> > + case OVN_ICMP6_FRAG_MTU: {
> > + size_t oc_offset = encode_start_controller_op(
> > + ACTION_OPCODE_PUT_ICMP6_FRAG_MTU, true,
> > + NX_CTLR_NO_METER, ofpacts);
> > + ofpbuf_put(ofpacts, &load->imm.value.be32_int, sizeof(ovs_be32));
> > + encode_finish_controller_op(oc_offset, ofpacts);
> > + break;
> > + }
> > case OVN_FIELD_N_IDS:
> > default:
> > OVS_NOT_REACHED();
> > diff --git a/lib/logical-fields.c b/lib/logical-fields.c
> > index 8ad56aa53..8639523ea 100644
> > --- a/lib/logical-fields.c
> > +++ b/lib/logical-fields.c
> > @@ -29,6 +29,10 @@ const struct ovn_field ovn_fields[OVN_FIELD_N_IDS] = {
> > OVN_ICMP4_FRAG_MTU,
> > "icmp4.frag_mtu",
> > 2, 16,
> > + }, {
> > + OVN_ICMP6_FRAG_MTU,
> > + "icmp6.frag_mtu",
> > + 4, 32,
> > },
> > };
> >
> > @@ -257,6 +261,7 @@ ovn_init_symtab(struct shash *symtab)
> > expr_symtab_add_field(symtab, "pkt.mark", MFF_PKT_MARK, NULL, false);
> >
> > expr_symtab_add_ovn_field(symtab, "icmp4.frag_mtu",
> > OVN_ICMP4_FRAG_MTU);
> > + expr_symtab_add_ovn_field(symtab, "icmp6.frag_mtu",
> > OVN_ICMP6_FRAG_MTU);
> > }
> >
> > const char *
> > diff --git a/ovn-sb.xml b/ovn-sb.xml
> > index bc69b58c0..a626dbba8 100644
> > --- a/ovn-sb.xml
> > +++ b/ovn-sb.xml
> > @@ -1170,10 +1170,11 @@
> > <ul>
> > <li>
> > <code>icmp4.frag_mtu</code>
> > + <code>icmp6.frag_mtu</code>
> > <p>
> > - This field sets the low-order 16 bits of the ICMP4 header
> > field
> > - that is labelled "unused" in the ICMP specification as
> > defined
> > - in the RFC 1191 with the value specified in
> > + This field sets the low-order 16 bits of the ICMP{4,6}
> > header
> > + field that is labelled "unused" in the ICMP specification
> > as
> > + defined in the RFC 1191 with the value specified in
> > <var>constant</var>.
> > </p>
> >
> > diff --git a/tests/ovn.at b/tests/ovn.at
> > index 61132c291..124dd78d2 100644
> > --- a/tests/ovn.at
> > +++ b/tests/ovn.at
> > @@ -1510,6 +1510,14 @@ icmp6_error { };
> > encodes as controller(userdata=00.00.00.14.00.00.00.00)
> > has prereqs ip6
> >
> > +# icmp6_error with icmp6.frag_mtu
> > +icmp6_error { eth.dst = ff:ff:ff:ff:ff:ff; icmp6.frag_mtu = 1500; output;
> > }; output;
> > + encodes as
> > controller(userdata=00.00.00.14.00.00.00.00.00.19.00.10.80.00.06.06.ff.ff.ff.ff.ff.ff.00.00.ff.ff.00.28.00.00.23.20.00.25.00.00.00.00.00.00.00.03.00.10.00.00.00.15.00.00.00.00.00.00.05.dc.00.04.00.04.00.00.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00),resubmit(,64)
> > + has prereqs ip6
> > +
> > +icmp6.frag_mtu = 1500;
> > + encodes as
> > controller(userdata=00.00.00.15.00.00.00.00.00.00.05.dc,pause)
> > +
> > # tcp_reset
> > tcp_reset { eth.dst = ff:ff:ff:ff:ff:ff; output; }; output;
> > encodes as
> > controller(userdata=00.00.00.0b.00.00.00.00.00.19.00.10.80.00.06.06.ff.ff.ff.ff.ff.ff.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00),resubmit(,64)
> > diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c
> > index d1ab051ce..de7508851 100644
> > --- a/utilities/ovn-trace.c
> > +++ b/utilities/ovn-trace.c
> > @@ -2081,7 +2081,12 @@ execute_ovnfield_load(const struct ovnact_load
> > *load,
> > ntohs(load->imm.value.be16_int));
> > break;
> > }
> > -
> > + case OVN_ICMP6_FRAG_MTU: {
> > + ovntrace_node_append(super, OVNTRACE_NODE_MODIFY,
> > + "icmp6.frag_mtu = %u",
> > + ntohs(load->imm.value.be16_int));
> > + break;
> > + }
> > case OVN_FIELD_N_IDS:
> > default:
> > OVS_NOT_REACHED();
> > --
> > 2.26.2
> >
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> >
> >
More information about the dev
mailing list