+function get_vlan_filter () {
+
+ # Get VLAN stripping filter from PF searched by mac adress.
+ #
+ # Variables read:
+ # - MAC_ADDR - MAC address of VF.
+ # Variables set:
+ # - VLAN_ID - VLAN ids.
+
+ set -exuo pipefail
+
+ # Sed regular expression pattern.
+ exp="s/^.*vlan ([[:digit:]]+).*$/\1/"
+ VLAN_ID=$(ip link | grep vlan | grep ${MAC_ADDR} | sed -re "${exp}") || true
+ VLAN_ID="${VLAN_ID:-0}"
+}
+
+