본문 바로가기

TroubleShooting/Network

libnetfilter_queue 라이브러리의 nfq_data structure 구조체

728x90

- libnetfilter_queue 라이브러리에서 사용되는 중요한 구조체중 하나인 nfq_data 입니다.
struct nfq_data {
   
/* packet_hdr - it HAVE to be the same as struct nfqnl_msg_packet_hdr */
   
struct {
        uint32_t packet_id
; /* unique ID of packet in queue in network order */
        uint16_t hw_protocol
; /* hw protocol in network order */
        uint8_t hook
; /* netfilter hook */
   
} packet_hdr;
   
/* packet_hw - it HAVE to be the same as struct nfqnl_msg_packet_hw */
   
struct {
        uint16_t hw_addrlen
; /* len of hw_addr in network order */
        uint16_t _pad
;
        uint8_t hw_addr
[8];
   
} packet_hw;
   
/* tm */
   
struct {
       
long sec;
       
long usec;
   
} tm;

    uint32_t if_index
; /* Unique iface id */
    uint32_t verdict
; /* Netfilter verdict value */
    uint32_t mark
; /* Mark value */
    uint8_t if_name
[IFNAMSIZE]; /* Name of incoming or outgoing iface */
    uint32_t data_len
; /* Length of packet */
    uint8_t payload
[0]; /* packet data */
};

- libnetfilte_queue 라이브러리는 커널 패킷 필터에 의해 큐(queue)에 쌓인 패킷에 대한 API 들을 제공하는 사용자 영역(userspace) 라이브러리이다. 또한 예전 ip_queue / libipq 를 대체하는 시스템이다.
- dependencies :  libnetfilter_queue 는 libnfnetlink 와 nfnetlink_queue 서브시스템을 포함하는 커널(2.6.14 이후) 를 필요로 한다.
- features
 . 커널 nfnetlink_queue 서브시스템에서 큐잉된 패킷을 받는다
 . 패킷에 대한 판단(pass 또는 drop)  또는 변경된 패킷을 커널의 nfnetlink_queue 서브시스템으로 다시 보낸다(reinject)
 원문)
http://libnetfilter-queue.sourcearchive.com/documentation/0.0.17/libnetfilter__queue_8c-source.html#l00883 

'TroubleShooting > Network' 카테고리의 다른 글

STP(spanning tree protocol) 정의  (0) 2011.02.25
네트워크에서 IP 충돌이 날때 확인 방법  (0) 2011.02.01
ftp 정리  (0) 2010.11.05
snort inline 정리.... 시작  (0) 2010.08.25
unix socket 을 이용하는 예제  (0) 2010.06.24