기본 콘텐츠로 건너뛰기

글

라벨이 C 언어인 게시물 표시

struct net_device *dev features

/* Net device features */ int features; #define NETIF_F_SG 1 /* Scatter/gather IO. */ #define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */ #define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */ #define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */ #define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */ #define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */ #define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */ #define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */ #define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */ #define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ #define NETIF_F_TSO 2048 /* Can offload TCP/IP segmentation */

Using netfilter in a multi-threaded program

This was very helpful. However I think I'm not quite to the end of this path yet. I have the following rules in the mangle section of my iptables: iptables -t mangle -A PREROUTING -p tcp --dport 9999 -j NFQUEUE --queue-balance 0:1 iptables -t mangle -A PREROUTING -p tcp --sport 9999 -j NFQUEUE --queue-balance 0:1 I create 2 threads.Each thread does a nfq_open. So far so good. Thread 1 has his nfq_handle and thread 2 has his nfq_handle. Thread 1 does a nfq_create_queue on queue 0, and Thread 2 does a nfq_create_queue on queue 1. Each thread then opens a netlink handle. Each thread does this independently with the handle returned from nfq_open. Each thread gets an independent fd. When I run, only one thread receives traffic (queue 0 on thread #1). I am using iperf -P 8 for example (8 simultaneous threads/connections). Frankly I must be missing something since I don't see any relationship between the result of nfq_create_queue (which presumably binds to the queue number ...