Interdiff:

diff --git a/tools/master-ip-setup b/tools/master-ip-setup
index 1be9fc4..d40b4c3 100755
--- a/tools/master-ip-setup
+++ b/tools/master-ip-setup
@@ -63,7 +63,7 @@ start() {
 # Stop the master IP
 stop() {
   if ! ip addr show dev $MASTER_NETDEV | \
-        grep "$MASTER_IP/$MASTER_NETMASK"  >/dev/null 2>&1; then
+        grep -F " $MASTER_IP/$MASTER_NETMASK"  >/dev/null 2>&1; then
     echo "Master IP address not configured on this machine. Doing nothing."
     exit 0
   fi

Thanks,
Thomas


On Wed, May 15, 2013 at 3:56 PM, Bernardo Dal Seno <[email protected]>wrote:

> On 15 May 2013 08:20, Thomas Thrainer <[email protected]> wrote:
> > The master IP setup script now checks if the master IP is actually
> > configured on the machine before trying to remove the IP.
> >
> > This fixes issue 460.
> >
> > Signed-off-by: Thomas Thrainer <[email protected]>
> > ---
> >  tools/master-ip-setup | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/tools/master-ip-setup b/tools/master-ip-setup
> > index bad47d1..1be9fc4 100755
> > --- a/tools/master-ip-setup
> > +++ b/tools/master-ip-setup
> > @@ -62,6 +62,12 @@ start() {
> >
> >  # Stop the master IP
> >  stop() {
> > +  if ! ip addr show dev $MASTER_NETDEV | \
> > +        grep "$MASTER_IP/$MASTER_NETMASK"  >/dev/null 2>&1; then
>
> I think you want to use the "-F" option of grep, as the address
> contains dots. And you should anchor at least the beginning of the
> expression, either by using a space or through regular expressions
> (but then you need to escape the address).
>
> > +    echo "Master IP address not configured on this machine. Doing
> nothing."
> > +    exit 0
> > +  fi
> > +
> >    if ! ip addr del $MASTER_IP/$MASTER_NETMASK dev $MASTER_NETDEV; then
> >      echo "Error during the deactivation of the master IP address" >&2
> >      exit 1
>
> Rest LGTM, thanks.
>
> Bernardo
>



-- 
Thomas Thrainer | Software Engineer | [email protected] |

Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Katherine Stephens

Reply via email to