Setting the skb->mark field from application
Hi all, Is it possible to set the skb->mark flied of the linux socket buffer from the application? Suppose application is using the Raw socket of Ethernet interface and it sends and receive packets to that interface. However, application wants to set the skb->mark filed of the socket buffer which in turn is honoured by the ethernet driver. I could not find any option in the api "setsockopt" which will allow to set the skb->mark field. Anybody having any idea if it can be done from the application? thanks, Vishwas S
Hello. Yes, you can do it with SO_MARK socket option.
From socket man: SO_MARK (since Linux 2.6.25) Set the mark for each packet sent through this socket (similar to the netfilter MARK target but socket-based). Changing the mark can be used for mark-based routing without netfilter or for packet filtering. Setting this option requires the CAP_NET_ADMIN capability.
2014-06-02 14:25 GMT+04:00 Vishwas Srivastava <vishu.kernel@gmail.com>:
Hi all, Is it possible to set the skb->mark flied of the linux socket buffer from the application?
Suppose application is using the Raw socket of Ethernet interface and it sends and receive packets to that interface. However, application wants to set the skb->mark filed of the socket buffer which in turn is honoured by the ethernet driver. I could not find any option in the api "setsockopt" which will allow to set the skb->mark field.
Anybody having any idea if it can be done from the application? thanks, Vishwas S
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Anton.
participants (2)
-
Anton Danilov -
Vishwas Srivastava