ldx / python-iptables

Python bindings for iptables
731 stars 183 forks source link

Matching with dscp values #313

Closed nandujayakumar closed 3 years ago

nandujayakumar commented 3 years ago

Don't we have any provision to match using DSCP value ???? Was not able to find the appropriate python API for it

ldx commented 3 years ago

Example:

import iptc

table = iptc.Table("filter")
chain = iptc.Chain(table, "INPUT")
rule = iptc.Rule(chain=chain)
rule.protocol = "tcp"
match = rule.create_match("dscp")
match.dscp_class = "BE"
target = rule.create_target("ACCEPT")
chain.insert_rule(rule)
nandujayakumar commented 3 years ago

Thanks @ldx