diff mbox

[ovs-dev] ovs-save: Handle MTU changes correctly.

Message ID 1460388424-3461-1-git-send-email-guru@ovn.org
State Accepted
Headers show

Commit Message

Gurucharan Shetty April 11, 2016, 3:27 p.m. UTC
The following command on ubuntu 12.04 returns null:
expr "mtu 1500" : '.*mtu \([0-9]+\)'

But the following works correctly:
expr "mtu 1500" : '.*mtu \([0-9]\+\)'

I am not sure about the portability implications as there
seems to be very sparse documentation about this.

VMware-BZ: #1638654
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
---
 utilities/ovs-save |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ansis Atteka April 11, 2016, 5:14 p.m. UTC | #1
On Mon, Apr 11, 2016 at 8:27 AM, Gurucharan Shetty <guru@ovn.org> wrote:
> The following command on ubuntu 12.04 returns null:
> expr "mtu 1500" : '.*mtu \([0-9]+\)'
>
> But the following works correctly:
> expr "mtu 1500" : '.*mtu \([0-9]\+\)'
>
> I am not sure about the portability implications as there
> seems to be very sparse documentation about this.
>
> VMware-BZ: #1638654
> Signed-off-by: Gurucharan Shetty <guru@ovn.org>

LGTM, Thanks for fixing this.
Gurucharan Shetty April 11, 2016, 5:26 p.m. UTC | #2
>
>
>
> LGTM, Thanks for fixing this.
>

Thanks. I updated the commit message to the following and pushed this to
master, 2.5, 2.4 and 2.3

ovs-save: Handle MTU changes correctly.

The following command on ubuntu 12.04, 14.04 and CentOS 7.x
returns null:
expr "mtu 1500" : '.*mtu \([0-9]+\)'

But the following works correctly:
expr "mtu 1500" : '.*mtu \([0-9]\+\)'

I am not sure about the portability implications as there
seems to be very sparse documentation about this but
this fixes a bug in 2 of the most popular distributions.

VMware-BZ: #1638654
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
diff mbox

Patch

diff --git a/utilities/ovs-save b/utilities/ovs-save
index 90320b1..d4d3c35 100755
--- a/utilities/ovs-save
+++ b/utilities/ovs-save
@@ -65,7 +65,7 @@  save_interfaces () {
         if expr "$state" : '.*\bdynamic\b' > /dev/null; then
             linkcmd="$linkcmd dynamic"
         fi
-        if qlen=`expr "$state" : '.*qlen \([0-9]+\)'`; then
+        if qlen=`expr "$state" : '.*qlen \([0-9]\+\)'`; then
             linkcmd="$linkcmd txqueuelen $qlen"
         fi
         if hwaddr=`expr "$state" : '.*link/ether \([^ ]*\)'`; then
@@ -74,7 +74,7 @@  save_interfaces () {
         if brd=`expr "$state" : '.*brd \([^ ]*\)'`; then
             linkcmd="$linkcmd broadcast $brd"
         fi
-        if mtu=`expr "$state" : '.*mtu \([0-9]+\)'`; then
+        if mtu=`expr "$state" : '.*mtu \([0-9]\+\)'`; then
             linkcmd="$linkcmd mtu $mtu"
         fi
         if test -n "$linkcmd"; then