Merge pull request #4282 from cristobalrosa/ansible

Add a fact for checking if interface is in promiscuous mode.
reviewable/pr18780/r1
James Tanner 11 years ago
commit 73d36f84b1

@ -1445,6 +1445,16 @@ class LinuxNetwork(Network):
if os.path.exists(path):
interfaces[device]['all_slaves_active'] = open(path).read() == '1'
# Check whether a interface is in promiscuous mode
if os.path.exists(os.path.join(path,'flags')):
promisc_mode = False
# The second byte indicates whether the interface is in promiscuous mode.
# 1 = promisc
# 0 = no promisc
data = int(open(os.path.join(path, 'flags')).read().strip(),16)
promisc_mode = (data & 0x0100 > 0)
interfaces[device]['promisc'] = promisc_mode
def parse_ip_output(output, secondary=False):
for line in output.split('\n'):
if not line:

Loading…
Cancel
Save