Set Fwmark for the packet from the application


I can set the mark for a packet in iptables mangle table by doing iptables -t mangle -I PREROUTING -s -j MARK --set-xmark 0x10/0xffffffff

This way I can mark the packets with source IP only with 0x10, or any other random value.

But I want to mark the packets with source IP as with different marks based on some dynamic variable on which I will mark.

Say at one point while sending the packet mark with 100, and when the variable value changes then the packet sent from that point will be marked with 200 and so on.

Since the dynamic variable is not a network parameter I can not use it in iptables to mark accordingly. Hence is there a way within my application while checking the dynamic variable, can I set a mark for that packet? My application is in golang. I am fine with other languages if there is a way.

asked on Stack Overflow Jun 19, 2020 by Arjun

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0