net: openvswitch: Add support to lookup invalid packet in ct action.
Subsystems (3)
RFC 1/1 net: openvswitch: Add support to lookup invalid packet in ct action.
From: Numan Siddique <[email protected]>
For a tcp packet which is part of an existing committed connection, nf_conntrack_in() will return err and set skb->_nfct to NULL if it is out of tcp window. ct action for this packet will set the ct_state to +inv which is as expected.
But a controller cannot add an OVS flow as
table=21,priority=100,ct_state=+inv, actions=drop
to drop such packets. That is because when ct action is executed on other packets which are not part of existing committed connections, ct_state can be set to invalid. Few such cases are:
- ICMP reply packets.
- TCP SYN/ACK packets during connection establishment.
- SCTP INIT ACK, COOKIE ACK, DATA and DATA ACK packets.
To distinguish between an invalid packet part of committed connection and others, this patch introduces as a new ct attribute OVS_CT_ATTR_LOOKUP_INV. If this is set in the ct action (without commit), it tries to find the ct entry and if present, sets the ct_state to +inv,+trk and also sets the mark and labels associated with the connection.
With this, a controller can add flows like
....
....
table=20,ip, action=ct(table=21, lookup_invalid) table=21,priority=100,ct_state=+inv+trk,ct_label=0x2/0x2 actions=drop table=21,ip, actions=resubmit(,22)
....
....
--- include/uapi/linux/openvswitch.h | 4 +++ net/openvswitch/conntrack.c | 47 ++++++++++++++++++++++++-------- 2 files changed, 40 insertions(+), 11 deletions(-)
include/uapi/linux/openvswitch.h +4 -0
@@ -768,6 +768,9 @@ struct ovs_action_hash {* respectively. Remaining bits control the changes for which an event is * delivered on the NFNLGRP_CONNTRACK_UPDATE group. * @OVS_CT_ATTR_TIMEOUT: Variable length string defining conntrack timeout. +* @OVS_CT_ATTR_LOOKUP_INV: If present, looks up and sets the state, mark and +* labels for an invalid packet (eg. out of tcp window) if it is part of +* committed connection. */ enum ovs_ct_attr {OVS_CT_ATTR_UNSPEC ,
@@ -782,6 +785,7 @@ enum ovs_ct_attr {OVS_CT_ATTR_EVENTMASK ,/* u32 mask of IPCT_* events. */ OVS_CT_ATTR_TIMEOUT ,/* Associate timeout with this connection for * fine-grain timeout tuning. */ +OVS_CT_ATTR_LOOKUP_INV ,/* No argument. */ __OVS_CT_ATTR_MAX };
net/openvswitch/conntrack.c +36 -11
93 lines not on this page · raw message
Signature · 1 line
2.26.2