Search code examples
ciptablesnetfilter

IPT_ALIGN macro not defined in netfilter_ipv4/ip_tables.h


I'm writing a small app to manage iptables rules using libiptc. I have used some sample code from https://it.bmc.uu.se/andlov/dev/library/Linux/libiptc/append.c to get started, but get the compiler error on line 31:

error: ‘IPT_ALIGN’ was not declared in this scope size_t entry_size = IPT_ALIGN(sizeof(struct ipt_entry));

I cannot see this macro defined in ip_tables.h, and so suspect that it is deprecated. The netfilter documentation still refers to it though.

Is there a new way to ensure correct alignment, that replaces this macro?

Thanks


Solution

  • It looks like the new macro may be COMPAT_XT_ALIGN. The old IPT_ALIGN was just an alias of XT_ALIGN, which appears to have been deprecated. (see here and here). I was not able to find any offical deprecation notice though.