diff --git a/akanda/router/drivers/ip.py b/akanda/router/drivers/ip.py index 4e12d1f..ec442d5 100644 --- a/akanda/router/drivers/ip.py +++ b/akanda/router/drivers/ip.py @@ -228,6 +228,13 @@ class IPManager(base.Manager): self.sudo(*fmt_args_add(item)) self.up(interface) + # Send a gratuitous ARP for new v4 addressees + ip, prefix = item + if ip.version == 4: + utils.execute([ + 'arping', '-A', '-c', '1', '-I', real_ifname, str(ip) + ], self.root_helper) + for item in (prev_set - next_set): self.sudo(*fmt_args_delete(item)) ip, prefix = item diff --git a/ansible/tasks/base.yml b/ansible/tasks/base.yml index 1336709..219171e 100644 --- a/ansible/tasks/base.yml +++ b/ansible/tasks/base.yml @@ -8,6 +8,7 @@ - iptables-persistent - conntrack - ntp + - arping - name: latest bash (CVE-2014-6271) apt: name=bash state=latest install_recommends=no diff --git a/test/unit/drivers/test_ip.py b/test/unit/drivers/test_ip.py index 737db8c..5310701 100644 --- a/test/unit/drivers/test_ip.py +++ b/test/unit/drivers/test_ip.py @@ -259,6 +259,9 @@ class IPTestCase(TestCase): ], 'sudo'), mock.call([cmd, 'link', 'set', 'em0', 'up'], 'sudo'), mock.call([cmd, 'addr', 'show', 'em0']), + mock.call([ + 'arping', '-A', '-c', '1', '-I', 'em0', '192.168.105.2' + ], 'sudo'), mock.call([ cmd, '-6', 'addr', 'add', 'fdca:3ba5:a17a:acda:20c:29ff:fe94:723d/64', 'dev', 'em0' @@ -314,6 +317,9 @@ class IPTestCase(TestCase): ], 'sudo'), mock.call(['/sbin/ip', 'link', 'set', 'em0', 'up'], 'sudo'), mock.call(['/sbin/ip', 'addr', 'show', 'em0']), + mock.call([ + 'arping', '-A', '-c', '1', '-I', 'em0', str(a.ip) + ], 'sudo'), mock.call([ '/sbin/ip', 'addr', 'del', str(c), 'dev', 'em0' ], 'sudo'),