# Path: vif_plug_linux_bridge/privsep.py



import inspect
import os
import re
from oslo_concurrency import lockutils
from oslo_concurrency import processutils
from vif_plug_linux_bridge import privsep
# TODO(jaypipes): Replace this entire module with use of the python-iptables
# library: https://github.com/ldx/python-iptables




# NOTE(vish): Iptables supports chain names of up to 28 characters,  and we
#             add up to 12 characters to binary_name which is used as a prefix,
#             so we limit it to 16 characters.
#             (max_chain_name_length - len('-POSTROUTING') == 16)
def get_binary_name():
    """Grab the name of the binary we're running in."""
    return os.path.basename(inspect.stack()[-1][1])[:16]


binary_name = get_binary_name()


@privsep.vif_plug.entrypoint
def iptables_save():
    return processutils.execute('iptables-save',
                                '-c', attempts=5)


@privsep.vif_plug.entrypoint
def ip6tables_save():
    return processutils.execute('ip6tables-save',
                                '-c', attempts=5)



# Path: vif_plug_linux_bridge/privsep.py



# Path: vif_plug_linux_bridge/iptables.py
import inspect
import os
import re
from oslo_concurrency import lockutils
from oslo_concurrency import processutils
from vif_plug_linux_bridge import privsep

# TODO(jaypipes): Replace this entire module with use of the python-iptables
# library: https://github.com/ldx/python-iptables




# NOTE(vish): Iptables supports chain names of up to 28 characters,  and we
#             add up to 12 characters to binary_name which is used as a prefix,
#             so we limit it to 16 characters.
#             (max_chain_name_length - len('-POSTROUTING') == 16)
def get_binary_name():
    """Grab the name of the binary we're running in."""
    return os.path.basename(inspect.stack()[-1][1])[:16]


binary_name = get_binary_name()


@privsep.vif_plug.entrypoint
def iptables_save():
    return processutils.execute('iptables-save',
                                '-c', attempts=5)


@privsep.vif_plug.entrypoint
def ip6tables_save():
    return processutils.execute('ip6tables-save',
                                '-c', attempts=5)



@privsep.vif_plug.entrypoint