mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #4282 from cristobalrosa/ansible
Add a fact for checking if interface is in promiscuous mode.
This commit is contained in:
commit
7eadf78009
1 changed files with 10 additions and 0 deletions
|
@ -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