Send a gratutious ARP when a v4 new address is added.

Change-Id: I51da87b40e1b68e1554c2ba1dd45838063dbf101
Closes-Bug: #1453201
This commit is contained in:
Ryan Petrello 2015-05-08 09:17:29 -04:00
parent f8701a0a6f
commit 434642c4fd
3 changed files with 14 additions and 0 deletions

View File

@ -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

View File

@ -8,6 +8,7 @@
- iptables-persistent
- conntrack
- ntp
- arping
- name: latest bash (CVE-2014-6271)
apt: name=bash state=latest install_recommends=no

View File

@ -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'),