|
|
@ -324,9 +324,12 @@ class ContainerDHCPManager:
|
|
|
|
|
|
|
|
|
|
|
|
logger.info('[dhcp container] Replacing gateway with %s', dhcp.gateway)
|
|
|
|
logger.info('[dhcp container] Replacing gateway with %s', dhcp.gateway)
|
|
|
|
proc = NSPopen(dhcp.netns, ['/sbin/ip', 'route', 'replace', 'default', 'via', str(dhcp.gateway)])
|
|
|
|
proc = NSPopen(dhcp.netns, ['/sbin/ip', 'route', 'replace', 'default', 'via', str(dhcp.gateway)])
|
|
|
|
|
|
|
|
try:
|
|
|
|
if proc.wait(timeout=1) != 0:
|
|
|
|
if proc.wait(timeout=1) != 0:
|
|
|
|
raise NetDhcpError(f'Failed to replace default route; "ip route" command exited with non-zero code %d', \
|
|
|
|
raise NetDhcpError(f'Failed to replace default route; "ip route" command exited with non-zero code %d', \
|
|
|
|
proc.returncode)
|
|
|
|
proc.returncode)
|
|
|
|
|
|
|
|
finally:
|
|
|
|
|
|
|
|
proc.release()
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: Adding default route with NDB seems to be broken (because of the dst syntax?)
|
|
|
|
# TODO: Adding default route with NDB seems to be broken (because of the dst syntax?)
|
|
|
|
#for route in ndb.routes:
|
|
|
|
#for route in ndb.routes:
|
|
|
@ -362,6 +365,8 @@ class ContainerDHCPManager:
|
|
|
|
self.dhcp6.netns)
|
|
|
|
self.dhcp6.netns)
|
|
|
|
except Exception as e:
|
|
|
|
except Exception as e:
|
|
|
|
logger.exception(e)
|
|
|
|
logger.exception(e)
|
|
|
|
|
|
|
|
if self.dhcp:
|
|
|
|
|
|
|
|
self.dhcp.finish(timeout=1)
|
|
|
|
|
|
|
|
|
|
|
|
def stop(self):
|
|
|
|
def stop(self):
|
|
|
|
if not self.dhcp:
|
|
|
|
if not self.dhcp:
|
|
|
|