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. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/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. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/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 thinkthat>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 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/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. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel