All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add default netmask to vif-nat
@ 2005-12-08 20:41 James Dykman
  2005-12-09 10:32 ` Ewan Mellor
  0 siblings, 1 reply; 4+ messages in thread
From: James Dykman @ 2005-12-08 20:41 UTC (permalink / raw)
  To: xen-devel

If vif-nat is passed an IP address "10.1.1.27" instead of "10.1.1.27/16", 
bits is an empty string. This causes a syntax error on 
line 89 while setting intmask, and another "Hotplug scripts not working" 
error.

This patch adds a default value, though a case can be made for removing 
intmask, vif_int, netmask, and network since they
don't seem to be used for anything.

Signed-off-by: Jim Dykman <dykman@us.ibm.com>

diff -r c9772105fead tools/examples/vif-nat
--- a/tools/examples/vif-nat    Thu Dec  8 15:04:41 2005
+++ b/tools/examples/vif-nat    Thu Dec  8 13:47:08 2005
@@ -81,7 +81,9 @@

 # Split the given IP/bits pair.
 vif_ip=`echo ${ip} | awk -F/ '{print $1}'`
-bits=`echo ${ip} | awk -F/ '{print $2}'`
+bits_or_nothing=`echo ${ip} | awk -F/ '{print $2}'`
+# Default to /24
+bits=${bits_or_nothing:-24}

 # Convert $bits and $vif_ip to integers, mask appropriately to get a 
network
 # address, and convert them both to dotted quads.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add default netmask to vif-nat
  2005-12-08 20:41 [PATCH] Add default netmask to vif-nat James Dykman
@ 2005-12-09 10:32 ` Ewan Mellor
  2005-12-09 16:26   ` James Dykman
  0 siblings, 1 reply; 4+ messages in thread
From: Ewan Mellor @ 2005-12-09 10:32 UTC (permalink / raw)
  To: James Dykman; +Cc: xen-devel

On Thu, Dec 08, 2005 at 03:41:53PM -0500, James Dykman wrote:

> If vif-nat is passed an IP address "10.1.1.27" instead of "10.1.1.27/16", 
> bits is an empty string. This causes a syntax error on 
> line 89 while setting intmask, and another "Hotplug scripts not working" 
> error.
> 
> This patch adds a default value, though a case can be made for removing 
> intmask, vif_int, netmask, and network since they
> don't seem to be used for anything.

Well if they aren't used for anything, let's get rid of them!

It looks like they were needed when we were using ifconfig to bring up the
interface, but since we are now manually adding the routing information using
"ip route", then we don't need them.

Could you submit a patch removing the cruft, making sure that
ip="10.1.1.27/16" and ip="10.1.1.27" both work?  Thanks.  I don't think that
the former is meaningful in the vif-nat topology, but for backwards
compatibility it would be good if both forms worked.

Thanks,

Ewan.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add default netmask to vif-nat
  2005-12-09 10:32 ` Ewan Mellor
@ 2005-12-09 16:26   ` James Dykman
  2005-12-12 11:15     ` Ewan Mellor
  0 siblings, 1 reply; 4+ messages in thread
From: James Dykman @ 2005-12-09 16:26 UTC (permalink / raw)
  To: xen-devel

>Could you submit a patch removing the cruft, making sure that
>ip="10.1.1.27/16" and ip="10.1.1.27" both work?  Thanks.  I don't think 
that
>the former is meaningful in the vif-nat topology, but for backwards
>compatibility it would be good if both forms worked.

OK.

Signed-off-by: Jim Dykman <dykman@us.ibm.com>

diff -r c9772105fead tools/examples/vif-nat
--- a/tools/examples/vif-nat    Thu Dec  8 15:04:41 2005
+++ b/tools/examples/vif-nat    Fri Dec  9 10:18:35 2005
@@ -81,17 +81,6 @@
 
 # Split the given IP/bits pair.
 vif_ip=`echo ${ip} | awk -F/ '{print $1}'`
-bits=`echo ${ip} | awk -F/ '{print $2}'`
-
-# Convert $bits and $vif_ip to integers, mask appropriately to get a 
network
-# address, and convert them both to dotted quads.
-
-intmask=$(( (0xFFFFFFFF << (32 - $bits)) & 0xFFFFFFFF ))
-vif_int=$(( $(echo "((($vif_ip" | sed -e 's#\.#)\*256\+#g') ))
-
-netmask=$(dotted_quad $intmask)
-network=$(dotted_quad $(( $vif_int & $intmask )) )
-
 
 hostname=$(xenstore_read "$XENBUS_PATH/domain" | tr -- '_.:/+' '-----')
 if [ "$vifid" != "1" ]


Jim

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add default netmask to vif-nat
  2005-12-09 16:26   ` James Dykman
@ 2005-12-12 11:15     ` Ewan Mellor
  0 siblings, 0 replies; 4+ messages in thread
From: Ewan Mellor @ 2005-12-12 11:15 UTC (permalink / raw)
  To: James Dykman; +Cc: xen-devel

On Fri, Dec 09, 2005 at 11:26:01AM -0500, James Dykman wrote:

> >Could you submit a patch removing the cruft, making sure that
> >ip="10.1.1.27/16" and ip="10.1.1.27" both work?  Thanks.  I don't think 
> that
> >the former is meaningful in the vif-nat topology, but for backwards
> >compatibility it would be good if both forms worked.
> 
> OK.
> 
> Signed-off-by: Jim Dykman <dykman@us.ibm.com>

Applied, thank you.

Ewan.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-12-12 11:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-08 20:41 [PATCH] Add default netmask to vif-nat James Dykman
2005-12-09 10:32 ` Ewan Mellor
2005-12-09 16:26   ` James Dykman
2005-12-12 11:15     ` Ewan Mellor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.