git://git.onelab.eu
/
vsys-scripts.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ff35284
)
pointopoint support
author
Claudio-Daniel Freire
<cdfreire@antar.inria.fr>
Mon, 23 May 2011 08:59:26 +0000
(10:59 +0200)
committer
Claudio-Daniel Freire
<cdfreire@antar.inria.fr>
Mon, 23 May 2011 08:59:26 +0000
(10:59 +0200)
exec/vif_up
patch
|
blob
|
history
diff --git
a/exec/vif_up
b/exec/vif_up
index
39557df
..
b7a35d3
100755
(executable)
--- a/
exec/vif_up
+++ b/
exec/vif_up
@@
-103,6
+103,7
@@
opt_txqueuelen = None
opt_rp_filter = None
opt_snat = None
opt_ovs_dp = None
opt_rp_filter = None
opt_snat = None
opt_ovs_dp = None
+opt_pointopoint = None
for optionline in options:
for optionline in options:
@@
-129,11
+130,17
@@
for optionline in options:
sys.exit(1)
opt_txqueuelen = intval
elif opt=="snat":
sys.exit(1)
opt_txqueuelen = intval
elif opt=="snat":
- intval = int(val)
- if val=="1":
- opt_snat = True
+ intval = int(val)
+ if val=="1":
+ opt_snat = True
+ elif opt=="pointopoint":
+ opt_pointopoint = val.strip()
+ try:
+ socket.inet_aton(opt_pointopoint)
+ except socket.error,e:
+ print >>sys.stderr, "pointopoint: %s" % (e,)
elif opt=="vswitch":
elif opt=="vswitch":
- opt_ovs_dp = val
+
opt_ovs_dp = val
else:
print >>sys.stderr, "Unknown option: \"%s\"" % (opt)
sys.exit(1)
else:
print >>sys.stderr, "Unknown option: \"%s\"" % (opt)
sys.exit(1)
@@
-141,10
+148,16
@@
for optionline in options:
### Configure interface
### Configure interface
-if opt_txqueuelen is None:
- cmd_ifconfig = "/sbin/ifconfig %s %s/%d" % (vif, vip, vmask)
+cmd_ifconfig = "/sbin/ifconfig %s %s" % (vif, vip)
+if opt_pointopoint is None:
+ cmd_ifconfig += "/%d" % (vmask,)
else:
else:
- cmd_ifconfig = "/sbin/ifconfig %s %s/%d txqueuelen %d" % (vif, vip, vmask, opt_txqueuelen)
+ # point-to-point mask
+ cmd_ifconfig += " netmask 255.255.255.255"
+if opt_txqueuelen is not None:
+ cmd_ifconfig += " txqueuelen %d" % (opt_txqueuelen,)
+if opt_pointopoint is not None:
+ cmd_ifconfig += " pointopoint %s" % (opt_pointopoint,)
os.system(cmd_ifconfig)
os.system(cmd_ifconfig)
@@
-171,6
+184,16
@@
if (opt_snat):
#print cmd_iptables_del_pr
#print cmd_iptables_pr
#print cmd_iptables_del_pr
#print cmd_iptables_pr
+#if opt_pointopoint and vmask < 32:
+# # Make target vnet masked address
+# p2p_int = struct.unpack('!L', socket.inet_aton(opt_pointopoint))[0]
+# vip_vnet = socket.inet_ntoa(
+# struct.pack('!L', ((p2p_int>>(32-vmask))<<(32-vmask))) )
+#
+# cmd_routing_p2p = "/sbin/route add -net %s/%d gw %s dev %s" % (vip_vnet, vmask, opt_pointopoint, vif)
+# print >>sys.stderr, cmd_routing_p2p
+# os.system(cmd_routing_p2p)
+
# Process additional options
if opt_rp_filter is not None:
rp_cmd = "/sbin/sysctl net.ipv4.conf.%s.rp_filter=%s" % (vif, opt_rp_filter)
# Process additional options
if opt_rp_filter is not None:
rp_cmd = "/sbin/sysctl net.ipv4.conf.%s.rp_filter=%s" % (vif, opt_rp_filter)
@@
-180,3
+203,4
@@
if opt_rp_filter is not None:
if opt_ovs_dp is not None:
cmd_ovs_addif = "ovs-dpctl add-if %s %s"%(opt_ovs_dp,vif)
os.system(cmd_ovs_addif)
if opt_ovs_dp is not None:
cmd_ovs_addif = "ovs-dpctl add-if %s %s"%(opt_ovs_dp,vif)
os.system(cmd_ovs_addif)
+