/* * callback function for handling packets */ static int cb(struct nfq_q_handle *qh, struct nfgenmsg *nfmsg, struct nfq_data *nfa, void *data) { struct nfqnl_msg_packet_hdr *ph; int decision, id=0; ph = nfq_get_msg_packet_hdr(nfa); if (ph) { id = ntohl(ph->packet_id); } /* check if we should block this packet */ decision = pkt_decision(nfa); if( decision == PKT_ACCEPT) { return nfq_set_verdict(qh, id, NF_ACCEPT, 0, NULL); } #if defined(DMP_CAPTIVEPORTAL_1) else if (decision == PKT_REDIRECT) { printf("GlbRedirectUrl %s\n", GlbRedirectUrl); return AEI_send_redirect(qh, id, nfa, GlbRedirectUrl); } #endif else { return nfq_set_verdict(qh, id, NF_DROP, 0, NULL); } }
/* * callback function for handling packets */ static int cb(struct nfq_q_handle *qh, struct nfgenmsg *nfmsg, struct nfq_data *nfa, void *data) { struct nfqnl_msg_packet_hdr *ph; int decision, id=0; ph = nfq_get_msg_packet_hdr(nfa); if (ph) { id = ntohl(ph->packet_id); } /* check if we should block this packet */ decision = pkt_decision(nfa); if( decision == PKT_ACCEPT) { return nfq_set_verdict(qh, id, NF_ACCEPT, 0, NULL); } else { return nfq_set_verdict(qh, id, NF_DROP, 0, NULL); } }