INNER CODE UNIT · C
hwProtocol
ukanth/afwall · external/nflog/nflog.c:325
hwProtocol = ntohs(pktHdr->hw_protocol);
}
}
if (tb[NFULA_PAYLOAD]) {
switch (hwProtocol) {
case ETH_P_IP: {
struct iphdr *iph = (struct iphdr *) mnl_attr_get_payload(tb[NFULA_PAYLOAD]);
if (iph && mnl_attr_get_payload_len(tb[NFULA_PAYLOAD]) >= sizeof(struct iphdr)) {
char addressStr[INET_ADDRSTRLEN];
// Source address
if (inet_ntop(AF_INET, &iph->saddr, addressStr, sizeof(addressStr))) {
printf("SRC=%s ", addressStr);
}
// Destination address
if (inet_ntop(AF_INET, &iph->daddr, addressStr, sizeof(addressStr))) {