]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
xdp.py: The ports set is now unused in XSK mode
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 15 Jan 2024 15:09:22 +0000 (16:09 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 23 Jan 2024 11:54:23 +0000 (12:54 +0100)
contrib/xdp.py

index 67ad96b917f7c03304671a119670a71fcf51ce7b..d6ef369708e92b699ab2b3afb853fade511bdc9a 100644 (file)
@@ -13,7 +13,7 @@ ACTIONS = {1 : 'DROP', 2 : 'TC'}
 DROP_ACTION = 1
 TC_ACTION = 2
 
-# The interface on wich the filter will be attached 
+# The interface on wich the filter will be attached
 DEV = "eth1"
 
 # The list of blocked IPv4, IPv6 and QNames
@@ -28,12 +28,13 @@ blocked_qnames = [("localhost", "A", DROP_ACTION), ("test.com", "*", TC_ACTION)]
 
 # Main
 useXsk = True
-Ports = [53]
 cflag = []
 if useXsk:
   cflag.append("-DUseXsk")
-IN_DNS_PORT_SET = "||".join("COMPARE_PORT((x),"+str(i)+")" for i in Ports)
-cflag.append(r"-DIN_DNS_PORT_SET(x)=(" + IN_DNS_PORT_SET + r")")
+else:
+  Ports = [53]
+  IN_DNS_PORT_SET = "||".join("COMPARE_PORT((x),"+str(i)+")" for i in Ports)
+  cflag.append(r"-DIN_DNS_PORT_SET(x)=(" + IN_DNS_PORT_SET + r")")
 
 xdp = BPF(src_file="xdp-filter.ebpf.src", cflags=cflag)