INNER CODE UNIT · C
log_cb
ukanth/afwall · external/nflog/nflog.c:281
static int log_cb(const struct nlmsghdr *nlh, void *data) {
struct nlattr *tb[NFULA_MAX+1] = {};
char ifname_buf[IFNAMSIZ];
if (!nlh) {
return MNL_CB_ERROR;
}
if (mnl_attr_parse(nlh, sizeof(struct nfgenmsg), parse_attr_cb, tb) < 0) {
return MNL_CB_ERROR;
}
// Print prefix if available
if (tb[NFULA_PREFIX]) {
const char *prefix = mnl_attr_get_str(tb[NFULA_PREFIX]);
if (prefix) {
printf("%s ", prefix);
}