|
|
@@ -338,8 +338,8 @@ class ContainerDHCPManager:
|
|
|
if path.lexists('{dhcp.netns}'):
|
|
|
logger.info('[dhcp container] Flushing IP addresses')
|
|
|
subprocess.check_call(['nsenter', f'-n{dhcp.netns}', '--', '/sbin/ip', 'address', 'flush', 'dev',
|
|
|
- str(dhcp.iface['ifname'])], timeout=1, stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
|
|
|
- stderr=subprocess.DEVNULL)
|
|
|
+ str(dhcp.iface['ifname']), 'label', str(dhcp.iface['ifname'])],
|
|
|
+ timeout=1, stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
|
else:
|
|
|
logger.info('[dhcp container] Container gone, can\'t flush IP addresses')
|
|
|
elif event_type == udhcpc.EventType.RENEW or event_type == udhcpc.EventType.BOUND:
|
|
|
@@ -350,19 +350,19 @@ class ContainerDHCPManager:
|
|
|
|
|
|
logger.info('[dhcp container] Flushing IP addresses')
|
|
|
subprocess.check_call(['nsenter', f'-n{dhcp.netns}', '--', '/sbin/ip', 'address', 'flush', 'dev',
|
|
|
- str(dhcp.iface['ifname'])], timeout=1, stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
|
|
|
- stderr=subprocess.DEVNULL)
|
|
|
+ str(dhcp.iface['ifname']), 'label', str(dhcp.iface['ifname'])],
|
|
|
+ timeout=1, stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
|
|
|
|
logger.info('[dhcp container] Adding IP addresses %s', dhcp.ip)
|
|
|
subprocess.check_call(['nsenter', f'-n{dhcp.netns}', '--', '/sbin/ip', 'address', 'add', str(dhcp.ip), 'dev',
|
|
|
- str(dhcp.iface['ifname'])], timeout=1, stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
|
|
|
- stderr=subprocess.DEVNULL)
|
|
|
+ str(dhcp.iface['ifname'])],
|
|
|
+ timeout=1, stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
|
|
|
|
if dhcp.gateway:
|
|
|
logger.info('[dhcp container] Replacing gateway with %s', dhcp.gateway)
|
|
|
subprocess.check_call(['nsenter', f'-n{dhcp.netns}', '--', '/sbin/ip', 'route', 'replace', 'default', 'via',
|
|
|
- str(dhcp.gateway)], timeout=1, stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
|
|
|
- stderr=subprocess.DEVNULL)
|
|
|
+ str(dhcp.gateway)],
|
|
|
+ timeout=1, stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
|
else:
|
|
|
logger.info('[dhcp container] Unhandled Event %s: %s', event_type,_event)
|
|
|
|