The new timestamp column in MAC_Binding is populated with current time whenever the row is created or the MAC address is updated. This can be utilized by MAC binding aging mechanism, when we can check if enough time has passed since the creation/update.
Reported-at: https://bugzilla.redhat.com/2084668 Acked-By: Ihar Hrachyshka <[email protected]> Signed-off-by: Ales Musil <[email protected]> --- v3: Rebase on top of current main. Update according to the final conclusion. v4: Rebase on top of current main. Add ack from Ihar. --- controller/pinctrl.c | 2 ++ northd/ovn-northd.c | 2 +- ovn-sb.ovsschema | 5 +++-- ovn-sb.xml | 6 ++++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/controller/pinctrl.c b/controller/pinctrl.c index e3ac829ce..eeb6f7527 100644 --- a/controller/pinctrl.c +++ b/controller/pinctrl.c @@ -4245,8 +4245,10 @@ mac_binding_add_to_sb(struct ovsdb_idl_txn *ovnsb_idl_txn, sbrec_mac_binding_set_ip(b, ip); sbrec_mac_binding_set_mac(b, mac_string); sbrec_mac_binding_set_datapath(b, dp); + sbrec_mac_binding_set_timestamp(b, time_wall_msec()); } else if (strcmp(b->mac, mac_string)) { sbrec_mac_binding_set_mac(b, mac_string); + sbrec_mac_binding_set_timestamp(b, time_wall_msec()); } } diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index ab28756af..bd35802ed 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -115,7 +115,7 @@ static const char *rbac_port_binding_update[] = static const char *rbac_mac_binding_auth[] = {""}; static const char *rbac_mac_binding_update[] = - {"logical_port", "ip", "mac", "datapath"}; + {"logical_port", "ip", "mac", "datapath", "timestamp"}; static const char *rbac_svc_monitor_auth[] = {""}; diff --git a/ovn-sb.ovsschema b/ovn-sb.ovsschema index 3b78ea6f6..bca552b5e 100644 --- a/ovn-sb.ovsschema +++ b/ovn-sb.ovsschema @@ -1,7 +1,7 @@ { "name": "OVN_Southbound", - "version": "20.23.0", - "cksum": "4045988377 28575", + "version": "20.24.0", + "cksum": "4165157445 28634", "tables": { "SB_Global": { "columns": { @@ -260,6 +260,7 @@ "logical_port": {"type": "string"}, "ip": {"type": "string"}, "mac": {"type": "string"}, + "timestamp": {"type": {"key": "integer"}}, "datapath": {"type": {"key": {"type": "uuid", "refTable": "Datapath_Binding"}}}}, "indexes": [["logical_port", "ip"]], diff --git a/ovn-sb.xml b/ovn-sb.xml index 59ad3aa2d..c5e6c9cc1 100644 --- a/ovn-sb.xml +++ b/ovn-sb.xml @@ -3621,6 +3621,12 @@ tcp.flags = RST; <column name="mac"> The Ethernet address to which the IP is bound. </column> + + <column name="timestamp"> + The timestamp in msec when the MAC binding was added or updated. + Records that existed before this column will have 0. + </column> + <column name="datapath"> The logical datapath to which the logical port belongs. </column> -- 2.37.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
