(dvb_ifs)
Disable reverse-path (RP) filtering for the DVB interface

    There are two layers of RP filters, one specific to the network interface
    and a higher level that controls the configurations for all network
    interfaces. This function disables RP filtering on the top layer (for all
    interfaces) but then enables RP filtering individually on all interfaces,
    except the DVB-S2 interface of interst. This way, in the end, only the
    DVB-S2 interface has RP filtering disabled.

    If the top layer RP filter (the "all" rule) is already disabled, this
    function disables only the target DVB-S2 interface. This strategy is
    especially useful when multiple DVB-S2 interfaces are attached to the
    host. If one of them has already disabled the "all" rule, this function
    disables only the incoming DVB-S2 interface and doesn't re-enable the RP
    filters of the other interfaces, otherwise it would end up reactivating the
    filter for the other DVB-S2 interface(s).

    Args:
        dvb_ifs : List of target DVB-S2 network interfaces.
Disable reverse-path (RP) filtering for the DVB interface
Disable reverse - path ( RP ) filtering for the DVB interface
def _set_filters(dvb_ifs):
    """Disable reverse-path (RP) filtering for the DVB interface

    There are two layers of RP filters, one specific to the network interface
    and a higher level that controls the configurations for all network
    interfaces. This function disables RP filtering on the top layer (for all
    interfaces) but then enables RP filtering individually on all interfaces,
    except the DVB-S2 interface of interst. This way, in the end, only the
    DVB-S2 interface has RP filtering disabled.

    If the top layer RP filter (the "all" rule) is already disabled, this
    function disables only the target DVB-S2 interface. This strategy is
    especially useful when multiple DVB-S2 interfaces are attached to the
    host. If one of them has already disabled the "all" rule, this function
    disables only the incoming DVB-S2 interface and doesn't re-enable the RP
    filters of the other interfaces, otherwise it would end up reactivating the
    filter for the other DVB-S2 interface(s).

    Args:
        dvb_ifs : List of target DVB-S2 network interfaces.

    """
    assert (isinstance(dvb_ifs, list))

    # If the "all" rule is already disabled, disable only the target DVB-S2
    # interface.
    if (_read_filter("all", nodry=True) == 0):
        if (not runner.dry):
            print("RP filter for \"all\" interfaces is already disabled")

        for dvb_if in dvb_ifs:
            _rm_filter(dvb_if)

    # If the "all" rule is enabled, disable it, and manually enable the RP
    # filtering on all other interfaces.
    else:
        # Check interfaces
        ifs = os.listdir("/proc/sys/net/ipv4/conf/")

        # Enable all RP filters
        for interface in ifs:
            if (interface == "all" or interface == "lo"
                    or interface in dvb_ifs):
                continue

            # Enable the RP filter if not enabled already.
            if (_read_filter(interface, nodry=True) > 0):
                if (not runner.dry):
                    print("RP filter is already enabled on interface %s" %
                          (interface))
            else:
                _add_filter(interface)

        # Disable the overall RP filter
        _rm_filter("all")

        # And disable RP filtering on the DVB interface
        for dvb_if in dvb_ifs:
            _rm_filter(dvb_if)
def _set_filters ( dvb_ifs ) : assert ( isinstance ( dvb_ifs , list ) ) # If the "all" rule is already disabled, disable only the target DVB-S2 # interface. if ( _read_filter ( "all" , nodry = True ) == 0 ) : if ( not runner . dry ) : print ( "RP filter for \"all\" interfaces is already disabled" ) for dvb_if in dvb_ifs : _rm_filter ( dvb_if ) # If the "all" rule is enabled, disable it, and manually enable the RP # filtering on all other interfaces. else : # Check interfaces ifs = os . listdir ( "/proc/sys/net/ipv4/conf/" ) # Enable all RP filters for interface in ifs : if ( interface == "all" or interface == "lo" or interface in dvb_ifs ) : continue # Enable the RP filter if not enabled already. if ( _read_filter ( interface , nodry = True ) > 0 ) : if ( not runner . dry ) : print ( "RP filter is already enabled on interface %s" % ( interface ) ) else : _add_filter ( interface ) # Disable the overall RP filter _rm_filter ( "all" ) # And disable RP filtering on the DVB interface for dvb_if in dvb_ifs : _rm_filter ( dvb_if )