(PPC fix).
= { NULL,
"icmp",
NETFILTER_VERSION,
- sizeof(struct ip6t_icmp),
- sizeof(struct ip6t_icmp),
+ IP6T_ALIGN(sizeof(struct ip6t_icmp)),
+ IP6T_ALIGN(sizeof(struct ip6t_icmp)),
&help,
&init,
&parse,
= { NULL,
"standard",
NETFILTER_VERSION,
- sizeof(int),
- sizeof(int),
+ IP6T_ALIGN(sizeof(int)),
+ IP6T_ALIGN(sizeof(int)),
&help,
&init,
&parse,
= { NULL,
"tcp",
NETFILTER_VERSION,
- sizeof(struct ip6t_tcp),
- sizeof(struct ip6t_tcp),
+ IP6T_ALIGN(sizeof(struct ip6t_tcp)),
+ IP6T_ALIGN(sizeof(struct ip6t_tcp)),
&help,
&init,
&parse,
= { NULL,
"udp",
NETFILTER_VERSION,
- sizeof(struct ip6t_udp),
- sizeof(struct ip6t_udp),
+ IP6T_ALIGN(sizeof(struct ip6t_udp)),
+ IP6T_ALIGN(sizeof(struct ip6t_udp)),
&help,
&init,
&parse,
= { NULL,
"DNAT",
NETFILTER_VERSION,
- sizeof(struct ip_nat_multi_range),
- sizeof(struct ip_nat_multi_range),
+ IPT_ALIGN(sizeof(struct ip_nat_multi_range)),
+ IPT_ALIGN(sizeof(struct ip_nat_multi_range)),
&help,
&init,
&parse,
= { NULL,
"LOG",
NETFILTER_VERSION,
- sizeof(struct ipt_log_info),
- sizeof(struct ipt_log_info),
+ IPT_ALIGN(sizeof(struct ipt_log_info)),
+ IPT_ALIGN(sizeof(struct ipt_log_info)),
&help,
&init,
&parse,
= { NULL,
"MARK",
NETFILTER_VERSION,
- sizeof(struct ipt_mark_target_info),
- sizeof(struct ipt_mark_target_info),
+ IPT_ALIGN(sizeof(struct ipt_mark_target_info)),
+ IPT_ALIGN(sizeof(struct ipt_mark_target_info)),
&help,
&init,
&parse,
= { NULL,
"MASQUERADE",
NETFILTER_VERSION,
- sizeof(struct ip_nat_multi_range),
- sizeof(struct ip_nat_multi_range),
+ IPT_ALIGN(sizeof(struct ip_nat_multi_range)),
+ IPT_ALIGN(sizeof(struct ip_nat_multi_range)),
&help,
&init,
&parse,
= { NULL,
"REDIRECT",
NETFILTER_VERSION,
- sizeof(struct ip_nat_multi_range),
- sizeof(struct ip_nat_multi_range),
+ IPT_ALIGN(sizeof(struct ip_nat_multi_range)),
+ IPT_ALIGN(sizeof(struct ip_nat_multi_range)),
&help,
&init,
&parse,
= { NULL,
"REJECT",
NETFILTER_VERSION,
- sizeof(struct ipt_reject_info),
- sizeof(struct ipt_reject_info),
+ IPT_ALIGN(sizeof(struct ipt_reject_info)),
+ IPT_ALIGN(sizeof(struct ipt_reject_info)),
&help,
&init,
&parse,
= { NULL,
"SNAT",
NETFILTER_VERSION,
- sizeof(struct ip_nat_multi_range),
- sizeof(struct ip_nat_multi_range),
+ IPT_ALIGN(sizeof(struct ip_nat_multi_range)),
+ IPT_ALIGN(sizeof(struct ip_nat_multi_range)),
&help,
&init,
&parse,
= { NULL,
"TOS",
NETFILTER_VERSION,
- sizeof(struct ipt_tos_target_info),
- sizeof(struct ipt_tos_target_info),
+ IPT_ALIGN(sizeof(struct ipt_tos_target_info)),
+ IPT_ALIGN(sizeof(struct ipt_tos_target_info)),
&help,
&init,
&parse,
= { NULL,
"icmp",
NETFILTER_VERSION,
- sizeof(struct ipt_icmp),
- sizeof(struct ipt_icmp),
+ IPT_ALIGN(sizeof(struct ipt_icmp)),
+ IPT_ALIGN(sizeof(struct ipt_icmp)),
&help,
&init,
&parse,
= { NULL,
"limit",
NETFILTER_VERSION,
- sizeof(struct ipt_rateinfo),
+ IPT_ALIGN(sizeof(struct ipt_rateinfo)),
offsetof(struct ipt_rateinfo, prev),
&help,
&init,
= { NULL,
"mac",
NETFILTER_VERSION,
- sizeof(struct ipt_mac_info),
- sizeof(struct ipt_mac_info),
+ IPT_ALIGN(sizeof(struct ipt_mac_info)),
+ IPT_ALIGN(sizeof(struct ipt_mac_info)),
&help,
&init,
&parse,
= { NULL,
"mark",
NETFILTER_VERSION,
- sizeof(struct ipt_mark_info),
- sizeof(struct ipt_mark_info),
+ IPT_ALIGN(sizeof(struct ipt_mark_info)),
+ IPT_ALIGN(sizeof(struct ipt_mark_info)),
&help,
&init,
&parse,
= { NULL,
"multiport",
NETFILTER_VERSION,
- sizeof(struct ipt_multiport),
- sizeof(struct ipt_multiport),
+ IPT_ALIGN(sizeof(struct ipt_multiport)),
+ IPT_ALIGN(sizeof(struct ipt_multiport)),
&help,
&init,
&parse,
= { NULL,
"owner",
NETFILTER_VERSION,
- sizeof(struct ipt_owner_info),
- sizeof(struct ipt_owner_info),
+ IPT_ALIGN(sizeof(struct ipt_owner_info)),
+ IPT_ALIGN(sizeof(struct ipt_owner_info)),
&help,
&init,
&parse,
= { NULL,
"standard",
NETFILTER_VERSION,
- sizeof(int),
- sizeof(int),
+ IPT_ALIGN(sizeof(int)),
+ IPT_ALIGN(sizeof(int)),
&help,
&init,
&parse,
= { NULL,
"state",
NETFILTER_VERSION,
- sizeof(struct ipt_state_info),
- sizeof(struct ipt_state_info),
+ IPT_ALIGN(sizeof(struct ipt_state_info)),
+ IPT_ALIGN(sizeof(struct ipt_state_info)),
&help,
&init,
&parse,
const struct ipt_tcp *tcpinfo = (struct ipt_tcp *)match->data;
if (tcpinfo->spts[0] != 0
- && tcpinfo->spts[1] != 0xFFFF) {
+ || tcpinfo->spts[1] != 0xFFFF) {
if (tcpinfo->invflags & IPT_TCP_INV_SRCPT)
printf("! ");
if (tcpinfo->spts[0]
}
if (tcpinfo->dpts[0] != 0
- && tcpinfo->dpts[1] != 0xFFFF) {
+ || tcpinfo->dpts[1] != 0xFFFF) {
if (tcpinfo->invflags & IPT_TCP_INV_DSTPT)
printf("! ");
if (tcpinfo->dpts[0]
= { NULL,
"tcp",
NETFILTER_VERSION,
- sizeof(struct ipt_tcp),
- sizeof(struct ipt_tcp),
+ IPT_ALIGN(sizeof(struct ipt_tcp)),
+ IPT_ALIGN(sizeof(struct ipt_tcp)),
&help,
&init,
&parse,
= { NULL,
"tos",
NETFILTER_VERSION,
- sizeof(struct ipt_tos_info),
- sizeof(struct ipt_tos_info),
+ IPT_ALIGN(sizeof(struct ipt_tos_info)),
+ IPT_ALIGN(sizeof(struct ipt_tos_info)),
&help,
&init,
&parse,
const struct ipt_udp *udpinfo = (struct ipt_udp *)match->data;
if (udpinfo->spts[0] != 0
- && udpinfo->spts[1] != 0xFFFF) {
+ || udpinfo->spts[1] != 0xFFFF) {
if (udpinfo->invflags & IPT_UDP_INV_SRCPT)
printf("! ");
if (udpinfo->spts[0]
}
if (udpinfo->dpts[0] != 0
- && udpinfo->dpts[1] != 0xFFFF) {
+ || udpinfo->dpts[1] != 0xFFFF) {
if (udpinfo->invflags & IPT_UDP_INV_DSTPT)
printf("! ");
if (udpinfo->dpts[0]
= { NULL,
"udp",
NETFILTER_VERSION,
- sizeof(struct ipt_udp),
- sizeof(struct ipt_udp),
+ IPT_ALIGN(sizeof(struct ipt_udp)),
+ IPT_ALIGN(sizeof(struct ipt_udp)),
&help,
&init,
&parse,
= { NULL,
"unclean",
NETFILTER_VERSION,
- 0,
- 0,
+ IPT_ALIGN(0),
+ IPT_ALIGN(0),
&help,
&init,
&parse,
exit(1);
}
+ if (me->size != IPT_ALIGN(me->size)) {
+ fprintf(stderr, "%s: match `%s' has invalid size %u.\n",
+ program_name, me->name, me->size);
+ exit(1);
+ }
+
/* Prepend to list. */
me->next = iptables_matches;
iptables_matches = me;
exit(1);
}
+ if (me->size != IPT_ALIGN(me->size)) {
+ fprintf(stderr, "%s: target `%s' has invalid size %u.\n",
+ program_name, me->name, me->size);
+ exit(1);
+ }
+
/* Prepend to list. */
me->next = iptables_targets;
iptables_targets = me;
size = sizeof(struct ipt_entry);
for (m = iptables_matches; m; m = m->next)
- size += sizeof(struct ipt_entry_match) + m->size;
+ size += IPT_ALIGN(sizeof(struct ipt_entry_match)) + m->size;
mask = fw_calloc(1, size
- + sizeof(struct ipt_entry_target)
+ + IPT_ALIGN(sizeof(struct ipt_entry_target))
+ iptables_targets->size);
memset(mask, 0xFF, sizeof(struct ipt_entry));
for (m = iptables_matches; m; m = m->next) {
memset(mptr, 0xFF,
- sizeof(struct ipt_entry_match) + m->userspacesize);
- mptr += sizeof(struct ipt_entry_match) + m->size;
+ IPT_ALIGN(sizeof(struct ipt_entry_match))
+ + m->userspacesize);
+ mptr += IPT_ALIGN(sizeof(struct ipt_entry_match)) + m->size;
}
- memset(mptr, 0xFF, sizeof(struct ipt_entry_target));
- mptr += sizeof(struct ipt_entry_target);
- memset(mptr, 0xFF, iptables_targets->userspacesize);
+ memset(mptr, 0xFF,
+ IPT_ALIGN(sizeof(struct ipt_entry_target))
+ + iptables_targets->userspacesize);
return mask;
}
if (target) {
size_t size;
- size = IPT_ALIGN(sizeof(struct ipt_entry_target)
- + target->size);
+ size = IPT_ALIGN(sizeof(struct ipt_entry_target))
+ + target->size;
target->t = fw_calloc(1, size);
target->t->u.target_size = size;
"unexpected ! flag before --match");
m = find_match(optarg, LOAD_MUST_SUCCEED);
- size = IPT_ALIGN(sizeof(struct ipt_entry_match)
- + m->size);
+ size = IPT_ALIGN(sizeof(struct ipt_entry_match))
+ + m->size;
m->m = fw_calloc(1, size);
m->m->u.match_size = size;
strcpy(m->m->u.user.name, m->name);
/* Try loading protocol */
size_t size;
- size = IPT_ALIGN(sizeof(struct ipt_entry_match)
- + m->size);
+ size = IPT_ALIGN(sizeof(struct ipt_entry_match))
+ + m->size;
m->m = fw_calloc(1, size);
m->m->u.match_size = size;