[ovs-dev] ofproto: Include patch ports in mtu overriden check

Message ID 20170912085203.30026-1-nusiddiq@redhat.com
State Accepted
Headers show
Series
  • [ovs-dev] ofproto: Include patch ports in mtu overriden check
Related show

Commit Message

Numan Siddique Sept. 12, 2017, 8:52 a.m.
From: Numan Siddique <nusiddiq@redhat.com>

When a patch port is deleted from the bridge (with no other ports
in the bridge) and if the bridge was set to an MTU by the user earlier, the
MTU of the bridge is overriden to 1500. Please see the below link for the
steps to reproduce the issue.

This patch fixes this issue.

Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-September/338665.html
Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
---
 ofproto/ofproto.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Ben Pfaff Sept. 21, 2017, 5:43 p.m. | #1
On Tue, Sep 12, 2017 at 02:22:03PM +0530, nusiddiq@redhat.com wrote:
> From: Numan Siddique <nusiddiq@redhat.com>
> 
> When a patch port is deleted from the bridge (with no other ports
> in the bridge) and if the bridge was set to an MTU by the user earlier, the
> MTU of the bridge is overriden to 1500. Please see the below link for the
> steps to reproduce the issue.
> 
> This patch fixes this issue.
> 
> Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-September/338665.html
> Signed-off-by: Numan Siddique <nusiddiq@redhat.com>

Applied to master and branch-2.8.  I wasn't sure from IRC whether you
wanted it on branch-2.7 also; let me know.

Thanks a lot!
Numan Siddique Sept. 21, 2017, 6:05 p.m. | #2
On Thu, Sep 21, 2017 at 11:13 PM, Ben Pfaff <blp@ovn.org> wrote:

> On Tue, Sep 12, 2017 at 02:22:03PM +0530, nusiddiq@redhat.com wrote:
> > From: Numan Siddique <nusiddiq@redhat.com>
> >
> > When a patch port is deleted from the bridge (with no other ports
> > in the bridge) and if the bridge was set to an MTU by the user earlier,
> the
> > MTU of the bridge is overriden to 1500. Please see the below link for the
> > steps to reproduce the issue.
> >
> > This patch fixes this issue.
> >
> > Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-
> September/338665.html
> > Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
>
> Applied to master and branch-2.8.  I wasn't sure from IRC whether you
> wanted it on branch-2.7 also; let me know.
>
>
Thanks for the review Ben. I would prefer in 2.7 as well if it is possible.



> Thanks a lot!
>
Ben Pfaff Sept. 21, 2017, 9:07 p.m. | #3
On Thu, Sep 21, 2017 at 11:35:32PM +0530, Numan Siddique wrote:
> On Thu, Sep 21, 2017 at 11:13 PM, Ben Pfaff <blp@ovn.org> wrote:
> 
> > On Tue, Sep 12, 2017 at 02:22:03PM +0530, nusiddiq@redhat.com wrote:
> > > From: Numan Siddique <nusiddiq@redhat.com>
> > >
> > > When a patch port is deleted from the bridge (with no other ports
> > > in the bridge) and if the bridge was set to an MTU by the user earlier,
> > the
> > > MTU of the bridge is overriden to 1500. Please see the below link for the
> > > steps to reproduce the issue.
> > >
> > > This patch fixes this issue.
> > >
> > > Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-
> > September/338665.html
> > > Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
> >
> > Applied to master and branch-2.8.  I wasn't sure from IRC whether you
> > wanted it on branch-2.7 also; let me know.
> >
> >
> Thanks for the review Ben. I would prefer in 2.7 as well if it is possible.

OK, I applied it to branch-2.7 also.

Patch

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 7541af0b2..9950897b8 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -2721,18 +2721,20 @@  init_ports(struct ofproto *p)
 }
 
 static bool
-ofport_is_internal(const struct ofproto *p, const struct ofport *port)
+ofport_is_internal_or_patch(const struct ofproto *p, const struct ofport *port)
 {
     return !strcmp(netdev_get_type(port->netdev),
-                   ofproto_port_open_type(p->type, "internal"));
+                   ofproto_port_open_type(p->type, "internal")) ||
+           !strcmp(netdev_get_type(port->netdev),
+                   ofproto_port_open_type(p->type, "patch"));
 }
 
-/* If 'port' is internal and if the user didn't explicitly specify an mtu
- * through the database, we have to override it. */
+/* If 'port' is internal or patch and if the user didn't explicitly specify an
+ * mtu through the database, we have to override it. */
 static bool
 ofport_is_mtu_overridden(const struct ofproto *p, const struct ofport *port)
 {
-    return ofport_is_internal(p, port)
+    return ofport_is_internal_or_patch(p, port)
            && !netdev_mtu_is_user_config(port->netdev);
 }