Skip to content

Commit

Permalink
Merge pull request #11657 from marcusburghardt/network_sniffer_disabl…
Browse files Browse the repository at this point in the history
…ed_short_output

Simplify output of ip link show command
  • Loading branch information
Mab879 authored Mar 7, 2024
2 parents d08e8ce + d0724ed commit 923a2bd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

- name: "{{{ rule_title }}} - Gather network interfaces"
ansible.builtin.command:
cmd: ip link show
cmd: ip -o link show
register: network_interfaces

- name: "{{{ rule_title }}} - Disable promiscuous mode"
ansible.builtin.command:
cmd: ip link set dev {{ item.split(':')[1] }} multicast off promisc off
loop: "{{ network_interfaces.stdout_lines }}"
when: "item.split(':') | length == 3"
when: "item.split(':')"
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
# complexity = low
# disruption = low

for interface in $(ip link show | grep -E '^[0-9]' | cut -d ":" -f 2); do
for interface in $(ip -o link show | cut -d ":" -f 2); do
ip link set dev $interface multicast off promisc off
done
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

for interface in $(ip link show | grep -i promisc | sed 's/^.*: \(.*\):.*$/\1/'); do
for interface in $(ip -o link show | grep -i promisc | sed 's/^.*: \(.*\):.*$/\1/'); do
ip link set dev $interface promisc off
done

0 comments on commit 923a2bd

Please sign in to comment.