~ubuntu-branches/ubuntu/oneiric/libnetfilter-queue/oneiric

« back to all changes in this revision

Viewing changes to utils/nfqnl_test.c

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Wirt, Max Kellermann, Alexander Wirt
  • Date: 2009-04-02 11:12:02 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090402111202-62pf29vplokpvqp3
Tags: 0.0.17-1
[ Max Kellermann ]
* new upstream release
* build with libnfnetlink-dev 0.0.41

[ Alexander Wirt ]
* bump standardsversion (no changes) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
{
14
14
        int id = 0;
15
15
        struct nfqnl_msg_packet_hdr *ph;
 
16
        struct nfqnl_msg_packet_hw *hwph;
16
17
        u_int32_t mark,ifi; 
17
18
        int ret;
18
19
        char *data;
19
 
        
 
20
 
20
21
        ph = nfq_get_msg_packet_hdr(tb);
21
 
        if (ph){
 
22
        if (ph) {
22
23
                id = ntohl(ph->packet_id);
23
24
                printf("hw_protocol=0x%04x hook=%u id=%u ",
24
25
                        ntohs(ph->hw_protocol), ph->hook, id);
25
26
        }
26
 
        
 
27
 
 
28
        hwph = nfq_get_packet_hw(tb);
 
29
        if (hwph) {
 
30
                int i, hlen = ntohs(hwph->hw_addrlen);
 
31
 
 
32
                printf("hw_src_addr=");
 
33
                for (i = 0; i < hlen-1; i++)
 
34
                        printf("%02x:", hwph->hw_addr[i]);
 
35
                printf("%02x ", hwph->hw_addr[hlen-1]);
 
36
        }
 
37
 
27
38
        mark = nfq_get_nfmark(tb);
28
39
        if (mark)
29
40
                printf("mark=%u ", mark);
35
46
        ifi = nfq_get_outdev(tb);
36
47
        if (ifi)
37
48
                printf("outdev=%u ", ifi);
 
49
        ifi = nfq_get_physindev(tb);
 
50
        if (ifi)
 
51
                printf("physindev=%u ", ifi);
 
52
 
 
53
        ifi = nfq_get_physoutdev(tb);
 
54
        if (ifi)
 
55
                printf("physoutdev=%u ", ifi);
38
56
 
39
57
        ret = nfq_get_payload(tb, &data);
40
58
        if (ret >= 0)
95
113
                exit(1);
96
114
        }
97
115
 
98
 
        nh = nfq_nfnlh(h);
99
 
        fd = nfnl_fd(nh);
 
116
        fd = nfq_fd(h);
100
117
 
101
118
        while ((rv = recv(fd, buf, sizeof(buf), 0)) && rv >= 0) {
102
119
                printf("pkt received\n");