Commit 7eadf780 by James Tanner

Merge pull request #4282 from cristobalrosa/ansible

Add a fact for checking if interface is in promiscuous mode.
parents d0986a20 617f7bb0
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment