Logo Search packages:      
Sourcecode: ufw version File versions

def src::common::UFWRule::match (   x,
  y 
)

Check if rules match
Return codes:
  0  match
  1  no match
 -1  match all but action

Definition at line 285 of file common.py.

00285                    :
        '''Check if rules match
        Return codes:
          0  match
          1  no match
         -1  match all but action
        '''
        if not x or not y:
            raise ValueError()

        dbg_msg = _("No match")
        if x.dport != y.dport:
            debug(dbg_msg)
            return 1
        if x.sport != y.sport:
            debug(dbg_msg)
            return 1
        if x.protocol != y.protocol:
            debug(dbg_msg)
            return 1
        if x.src != y.src:
            debug(dbg_msg)
            return 1
        if x.dst != y.dst:
            debug(dbg_msg)
            return 1
        if x.v6 != y.v6:
            debug(dbg_msg)
            return 1
        if x.dapp != y.dapp:
            debug(dbg_msg)
            return 1
        if x.sapp != y.sapp:
            debug(dbg_msg)
            return 1
        if x.action == y.action:
            dbg_msg = _("Found exact match")
            debug(dbg_msg)
            return 0
        dbg_msg = _("Found non-action match")
        debug(dbg_msg)
        return -1

    def get_app_tuple(self):


Generated by  Doxygen 1.6.0   Back to index