Merge pull request #4282 from cristobalrosa/ansible
Add a fact for checking if interface is in promiscuous mode.
This commit is contained in:
commit
73d36f84b1
1 changed files with 10 additions and 0 deletions
10
system/setup
10
system/setup
|
@ -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…
Reference in a new issue