Commit 938da7ea authored by Guillaume Bury's avatar Guillaume Bury

Bootstrap peer fixed in registry

parent c899b4ec
...@@ -154,7 +154,7 @@ OPTIONS : VIFIBNET.PY ...@@ -154,7 +154,7 @@ OPTIONS : VIFIBNET.PY
line, vifibnet will attempt to forward a port with upnp for each line, vifibnet will attempt to forward a port with upnp for each
couple port/proto given. couple port/proto given.
Protocols should be either udp or tcp-server. Protocols should be either udp or tcp-server.
Default : (1194, udp) Default : (1194, udp), (1194, tcp-server)
--tunnel-refresh duration --tunnel-refresh duration
Interval in seconds between two tunnel refresh. Refreshing tunnels Interval in seconds between two tunnel refresh. Refreshing tunnels
......
Name ideas :
resnet ( for Resiliable NET )
rsnet ( Resiliable Scalable NET )
To be done : To be done :
use the server as a bootstrap node -> switch peer discovery to be done use the server as a bootstrap node -> switch peer discovery to be done
by vifibnet directly ? by vifibnet directly ?
......
...@@ -53,6 +53,9 @@ class main(object): ...@@ -53,6 +53,9 @@ class main(object):
help='Path to certificate key') help='Path to certificate key')
_('--mailhost', required=True, _('--mailhost', required=True,
help='SMTP server mail host') help='SMTP server mail host')
_('--bootstrap', required=True, nargs=4,
help='''VPN prefix, ip address, port and protocol to send as
bootstrap peer''')
self.config = parser.parse_args() self.config = parser.parse_args()
# Database initializing # Database initializing
...@@ -178,7 +181,8 @@ class main(object): ...@@ -178,7 +181,8 @@ class main(object):
# TODO: Insert a flag column for bootstrap ready servers in peers # TODO: Insert a flag column for bootstrap ready servers in peers
# ( servers which shouldn't go down or change ip and port as opposed to servers owned by particulars ) # ( servers which shouldn't go down or change ip and port as opposed to servers owned by particulars )
# that way, we also ascertain that the server sent is not the new node.... # that way, we also ascertain that the server sent is not the new node....
prefix, address = self.db.execute("SELECT prefix, address FROM peers ORDER BY random() LIMIT 1").next() prefix = self.config.bootstrap[0]
address = ','.join(self.config.bootstrap[1:])
print "Sending bootstrap peer (%s, %s)" % (prefix, str(address)) print "Sending bootstrap peer (%s, %s)" % (prefix, str(address))
return prefix, address return prefix, address
......
...@@ -174,3 +174,4 @@ class TunnelManager: ...@@ -174,3 +174,4 @@ class TunnelManager:
utils.log('Routes on iface %s : %s' % ( utils.log('Routes on iface %s : %s' % (
self._connection_dict[p].iface, self._connection_dict[p].iface,
self._connection_dict[p].routes), 5) self._connection_dict[p].routes), 5)
...@@ -85,7 +85,7 @@ def main(): ...@@ -85,7 +85,7 @@ def main():
# Get arguments # Get arguments
config = getConfig() config = getConfig()
if not config.pp: if not config.pp:
config.pp = [['1194', 'udp']] config.pp = [['1194', 'udp'], ['1194', 'tcp-server']]
manual = bool(config.address) manual = bool(config.address)
network = utils.networkFromCa(config.ca) network = utils.networkFromCa(config.ca)
internal_ip, prefix = utils.ipFromCert(network, config.cert) internal_ip, prefix = utils.ipFromCert(network, config.cert)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment