Skip to content

Commit

Permalink
OVN: add selected mac address to MACAM in update_dynamic_addresses
Browse files Browse the repository at this point in the history
Add selected dynamic mac address to MACAM in update_dynamic_addresses
and not just in in ipam_add_port_addresses/ipam_insert_lsp_addresses
since the second approach can produce a duplicated L2 address in a
IPv6-only network if ipv6_prefix is provided after logical port creation.
The issue can be triggered with the following reproducer:

$ovn-nbctl ls-add sw0
$ovn-nbctl lsp-add sw0 sw0-port1
$ovn-nbctl lsp-set-addresses sw0-port1 "dynamic"
$ovn-nbctl lsp-add sw0 sw0-port2
$ovn-nbctl lsp-set-addresses sw0-port2 "dynamic"
$ovs-vsctl add-port br-int p1 -- \
    set Interface p1 external_ids:iface-id=sw0-port1
$ovs-vsctl add-port br-int p2 -- \
    set Interface p2 external_ids:iface-id=sw0-port2
[..]
$ovn-nbctl --wait=sb set Logical-switch sw0 \
    other_config:ipv6_prefix="aef0::"

$ovn-nbctl list logical_switch_port
_uuid               : 1e0e2ed8-20c6-48dc-bfa8-d823e48c9f45
addresses           : [dynamic]
dhcpv4_options      : []
dhcpv6_options      : []
dynamic_addresses   : "0a:00:00:00:00:01 aef0::800:ff:fe00:1"
enabled             : []
external_ids        : {}
name                : "sw0-port1"
options             : {}
parent_name         : []
port_security       : []
tag                 : []
tag_request         : []
type                : ""
up                  : true

_uuid               : cfeab7fb-e20b-41f1-974c-f99e0b5293d7
addresses           : [dynamic]
dhcpv4_options      : []
dhcpv6_options      : []
dynamic_addresses   : "0a:00:00:00:00:01 aef0::800:ff:fe00:1"
enabled             : []
external_ids        : {}
name                : "sw0-port2"
options             : {}
parent_name         : []
port_security       : []
tag                 : []
tag_request         : []
type                : ""
up                  : true

Fixes: c814545 ("OVN: configure L2 address according to the used IP
address")

Acked-by: Mark Michelson <[email protected]>
Acked-by: Numan Siddique <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
LorenzoBianconi authored and blp committed Dec 12, 2018
1 parent fcc3c93 commit 04438db
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ovn/northd/ovn-northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,8 @@ update_dynamic_addresses(struct dynamic_address_update *update)

struct ds new_addr = DS_EMPTY_INITIALIZER;
ds_put_format(&new_addr, ETH_ADDR_FMT, ETH_ADDR_ARGS(mac));
ipam_insert_mac(&mac, true);

if (ip4) {
ipam_insert_ip(update->od, ntohl(ip4));
ds_put_format(&new_addr, " "IP_FMT, IP_ARGS(ip4));
Expand Down
13 changes: 13 additions & 0 deletions tests/ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -5741,6 +5741,19 @@ AT_CHECK([ovn-nbctl get Logical-Switch-Port p53 dynamic_addresses], [0],
["00:11:22:a8:64:05 192.168.100.4"
])

# verify configuration order does not break IPAM/MACAM
ovn-nbctl ls-add sw7
for n in $(seq 1 3); do
ovn-nbctl --wait=sb lsp-add sw7 "p7$n" -- lsp-set-addresses "p7$n" dynamic
done
ovn-nbctl --wait=sb set Logical-Switch sw7 other_config:ipv6_prefix="bef0::"
p71_addr=$(ovn-nbctl get Logical-Switch-Port p71 dynamic_addresses)
p72_addr=$(ovn-nbctl get Logical-Switch-Port p72 dynamic_addresses)
p73_addr=$(ovn-nbctl get Logical-Switch-Port p73 dynamic_addresses)
AT_CHECK([test "$p71_addr" != "$p72_addr"], [0], [])
AT_CHECK([test "$p71_addr" != "$p73_addr"], [0], [])
AT_CHECK([test "$p72_addr" != "$p73_addr"], [0], [])

as ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

Expand Down

0 comments on commit 04438db

Please sign in to comment.