INNER CODE UNIT · C

header_len

ukanth/afwall · external/nflog/nflog.c:349

                    int header_len = iph->ihl * 4;
                    if (header_len >= sizeof(struct iphdr) && 
                        mnl_attr_get_payload_len(tb[NFULA_PAYLOAD]) >= header_len) {
                        
                        switch(iph->protocol) {
                            case IPPROTO_TCP: {
                                if (mnl_attr_get_payload_len(tb[NFULA_PAYLOAD]) >= 
                                    header_len + sizeof(struct tcphdr)) {
                                    struct tcphdr *th = (struct tcphdr *) 
                                        ((uint8_t*)iph + header_len);
                                    printf("PROTO=TCP SPT=%u DPT=%u ",
                                            ntohs(th->source), ntohs(th->dest));
                                } else {
                                    printf("PROTO=TCP ");
                                }
                                break;
                            }
                            case IPPROTO_UDP: {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…