[ovs-dev] ovs-save: Handle different 'ip addr show' output.
diff mbox series

Message ID 1508391901-1739-1-git-send-email-guru@ovn.org
State Accepted
Headers show
Series
  • [ovs-dev] ovs-save: Handle different 'ip addr show' output.
Related show

Commit Message

Guru Shetty Oct. 19, 2017, 5:45 a.m. UTC
On RHEL 7.4 (with iproute-3.10.0-87), a DHCP provided
ipv4 address has the "dynamic" keyword set. For e.g
"ip addr show breth0 | grep inet" shows:

    inet 10.116.248.91/20 brd 10.116.255.255 scope global dynamic breth0
    inet6 fe80::250:56ff:fea8:fdf0/64 scope link

The keyword "dynamic" (according to 'man ip-address') is only
used for ipv6, but in this case this is not true. Our current
code will skip the ipv4 address restoration because of this.

With this commit, we special case "dynamic" keyword to be valid
in case of ipv4.

VMware-BZ: #1982196
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
---
 utilities/ovs-lib.in | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Yi-Hung Wei Oct. 20, 2017, 6:25 p.m. UTC | #1
Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>

On Wed, Oct 18, 2017 at 10:45 PM, Gurucharan Shetty <guru@ovn.org> wrote:
> On RHEL 7.4 (with iproute-3.10.0-87), a DHCP provided
> ipv4 address has the "dynamic" keyword set. For e.g
> "ip addr show breth0 | grep inet" shows:
>
>     inet 10.116.248.91/20 brd 10.116.255.255 scope global dynamic breth0
>     inet6 fe80::250:56ff:fea8:fdf0/64 scope link
>
> The keyword "dynamic" (according to 'man ip-address') is only
> used for ipv6, but in this case this is not true. Our current
> code will skip the ipv4 address restoration because of this.
>
> With this commit, we special case "dynamic" keyword to be valid
> in case of ipv4.
>
> VMware-BZ: #1982196
> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
> ---
>  utilities/ovs-lib.in | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
> index 8665698..ac2da85 100644
> --- a/utilities/ovs-lib.in
> +++ b/utilities/ovs-lib.in
> @@ -329,6 +329,14 @@ move_ip_address () {
>          while test $# != 0; do
>              case $1 in
>                  dynamic)
> +                    # XXX: According to 'man ip-address', "dynamic" is only
> +                    # used for ipv6 addresses.  But, atleast on RHEL 7.4
> +                    # (iproute-3.10.0-87), it is being used for ipv4
> +                    # addresses assigned with dhcp.
> +                    if [ "$family" = "inet" ]; then
> +                        shift
> +                        continue
> +                    fi
>                      # Omit kernel-maintained route.
>                      continue 2
>                      ;;
> --
> 1.9.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Guru Shetty Oct. 20, 2017, 7:44 p.m. UTC | #2
On 20 October 2017 at 11:25, Yi-Hung Wei <yihung.wei@gmail.com> wrote:

> Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
>

Thanks. I applied this to master and 2.8


>
> On Wed, Oct 18, 2017 at 10:45 PM, Gurucharan Shetty <guru@ovn.org> wrote:
> > On RHEL 7.4 (with iproute-3.10.0-87), a DHCP provided
> > ipv4 address has the "dynamic" keyword set. For e.g
> > "ip addr show breth0 | grep inet" shows:
> >
> >     inet 10.116.248.91/20 brd 10.116.255.255 scope global dynamic breth0
> >     inet6 fe80::250:56ff:fea8:fdf0/64 scope link
> >
> > The keyword "dynamic" (according to 'man ip-address') is only
> > used for ipv6, but in this case this is not true. Our current
> > code will skip the ipv4 address restoration because of this.
> >
> > With this commit, we special case "dynamic" keyword to be valid
> > in case of ipv4.
> >
> > VMware-BZ: #1982196
> > Signed-off-by: Gurucharan Shetty <guru@ovn.org>
> > ---
> >  utilities/ovs-lib.in | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
> > index 8665698..ac2da85 100644
> > --- a/utilities/ovs-lib.in
> > +++ b/utilities/ovs-lib.in
> > @@ -329,6 +329,14 @@ move_ip_address () {
> >          while test $# != 0; do
> >              case $1 in
> >                  dynamic)
> > +                    # XXX: According to 'man ip-address', "dynamic" is
> only
> > +                    # used for ipv6 addresses.  But, atleast on RHEL 7.4
> > +                    # (iproute-3.10.0-87), it is being used for ipv4
> > +                    # addresses assigned with dhcp.
> > +                    if [ "$family" = "inet" ]; then
> > +                        shift
> > +                        continue
> > +                    fi
> >                      # Omit kernel-maintained route.
> >                      continue 2
> >                      ;;
> > --
> > 1.9.1
> >
> > _______________________________________________
> > dev mailing list
> > dev@openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>

Patch
diff mbox series

diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
index 8665698..ac2da85 100644
--- a/utilities/ovs-lib.in
+++ b/utilities/ovs-lib.in
@@ -329,6 +329,14 @@  move_ip_address () {
         while test $# != 0; do
             case $1 in
                 dynamic)
+                    # XXX: According to 'man ip-address', "dynamic" is only
+                    # used for ipv6 addresses.  But, atleast on RHEL 7.4
+                    # (iproute-3.10.0-87), it is being used for ipv4
+                    # addresses assigned with dhcp.
+                    if [ "$family" = "inet" ]; then
+                        shift
+                        continue
+                    fi
                     # Omit kernel-maintained route.
                     continue 2
                     ;;