diff mbox series

[ovs-dev] Prevent erroneous duplicate IP address messages.

Message ID 20190808191648.16937-1-mmichels@redhat.com
State Superseded
Headers show
Series [ovs-dev] Prevent erroneous duplicate IP address messages. | expand

Commit Message

Mark Michelson Aug. 8, 2019, 7:16 p.m. UTC
When using dynamic address assignment for logical switches, OVN reserves
the first address in the subnet for the attached router port to use.

In commit 488d153ee87841c042af05bc0eb8b5481aaa98cf, the IPAM code was
modified to add assigned router port addresses to IPAM. The use case for
this was when a switch was joined to multiple routers, and all router
addresses were dynamically assigned.

However, that commit also made it so that when a router rightly claimed
the first address in the subnet, ovn-northd would issue a warning about
a duplicate IP address being set. This change fixes the issue by adding
a special case so that we don't add the router's IP address to IPAM if
it is the first address in the subnet. This prevents the warning message
from appearing.

Signed-off-by: Mark Michelson <mmichels@redhat.com>
---
 northd/ovn-northd.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

0-day Robot Aug. 8, 2019, 7:58 p.m. UTC | #1
Bleep bloop.  Greetings Mark Michelson, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


git-am:
fatal: sha1 information is lacking or useless (northd/ovn-northd.c).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 Prevent erroneous duplicate IP address messages.
The copy of the patch that failed is found in:
   /var/lib/jenkins/jobs/upstream_build_from_pw/workspace/.git/rebase-apply/patch
When you have resolved this problem, run "git am --resolved".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


Please check this out.  If you feel there has been an error, please email aconole@bytheb.org

Thanks,
0-day Robot
Han Zhou Aug. 8, 2019, 8:19 p.m. UTC | #2
On Thu, Aug 8, 2019 at 1:00 PM 0-day Robot <robot@bytheb.org> wrote:
>
> Bleep bloop.  Greetings Mark Michelson, I am a robot and I have tried out
your patch.
> Thanks for your contribution.
>
> I encountered some error that I wasn't expecting.  See the details below.
>
>
> git-am:
> fatal: sha1 information is lacking or useless (northd/ovn-northd.c).
> Repository lacks necessary blobs to fall back on 3-way merge.
> Cannot fall back to three-way merge.
> Patch failed at 0001 Prevent erroneous duplicate IP address messages.
> The copy of the patch that failed is found in:
>
 /var/lib/jenkins/jobs/upstream_build_from_pw/workspace/.git/rebase-apply/patch
> When you have resolved this problem, run "git am --resolved".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".
>
>
> Please check this out.  If you feel there has been an error, please email
aconole@bytheb.org
>
> Thanks,
> 0-day Robot
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev

0-day robot was complaining because "ovn" was missing in the title.

LGTM

Acked-by: Han Zhou <hzhou8@ebay.com>
diff mbox series

Patch

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index e6953a405..f27fb70e4 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -1194,7 +1194,14 @@  ipam_add_port_addresses(struct ovn_datapath *od, struct ovn_port *op)
 
         for (size_t i = 0; i < lrp_networks.n_ipv4_addrs; i++) {
             uint32_t ip = ntohl(lrp_networks.ipv4_addrs[i].addr);
-            ipam_insert_ip(op->peer->od, ip);
+            /* If the router has the first IP address of the subnet, don't add
+             * it to IPAM. We already added this when we initialized IPAM for
+             * the datapath. This will just result in an erroneous message
+             * about a duplicate IP address.
+             */
+            if (ip != op->peer->od->ipam_info.start_ipv4) {
+                ipam_insert_ip(op->peer->od, ip);
+            }
         }
 
         destroy_lport_addresses(&lrp_networks);