[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#646961: patch

And one more thing...

On 05.04.2012 13:37, Michael Tokarev wrote:
> On 04.04.2012 22:24, Robert Millan wrote:
>> -	    while /sbin/route del default gw dev $interface; do :; done
>> +	    if [ ${uname} = "GNU/kFreeBSD" ] ; then
>> +		while /lib/freebsd/route del -net dev $interface; do :; done
>> +	    else
>> +		while /sbin/route del default gw dev $interface; do :; done
>> +	    fi
> I also wonder if we can just test for /lib/freebsd/route
> existance instead of checking $(uname -r) ?
> Somehow I'm not comfortable with the uname check...
> Besides, where I can see the /sbin/route wrapper currently
> in use on kfreebsd?

I forgot that I had a qemu VM with kfreebsd, so I found it.


  # /lib/freebsd/route del -net dev re0
  route: bad address: dev

This is freebsd-net-tools 8.2+ds3-2.

Does it support "dev" ?

The difference between the two are actually quite small.
For example, the subsequent hunk from your patch:

 	    for i in $router; do
-		/sbin/route add default gw $i dev $interface metric $metric
+		if [ ${uname} = "GNU/kFreeBSD" ] ; then
+		    /lib/freebsd/route add -net $i dev $interface metric $metric
+		else
+		    /sbin/route add default gw $i dev $interface metric $metric
+		fi
 		metric=$(($metric + 1))

this difference can be reduced further:

    /sbin/route add -net gw $i dev $interface metric $metric

so we now have just two differences: the command name and "gw"
keyword.  /sbin/route script from freebsd-net-tools will just
strip "gw", so it should work without any changes.

But it will also remove metric and dev, at least if I understand
the code -- this should be easy to fix in the script.

But the same applies to the add command: my /lib/freebsd/route
does not accept "dev" keyword:

 # /lib/freebsd/route add -net dev re0 metric 0
 route: bad address: dev

Are you sure it's okay?

Besides, I'm not really sure why/when/how several routes can
be present.



Reply to: