Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pf: fix build on kernels without "options INET" #1511

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sys/netpfil/pf/pf.c
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,10 @@ static bool
pf_is_loopback(sa_family_t af, struct pf_addr *addr)
{
switch (af) {
#ifdef INET
case AF_INET:
return IN_LOOPBACK(ntohl(addr->v4.s_addr));
#endif
case AF_INET6:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this case also need an #ifdef INET6?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, because IN6_IS_ADDR_LOOPBACK() doesn't depend on any symbols.

IN_LOOPBACK() is strange because of the sysctl net.inet.ip.loopback_prefixlen which is why it references a VNET symbol.

this is not the first time i've fixed this exact same bug -- i'm wondering if we should just remove this 'feature' entirely.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, in efe5885, implementing draft-schoen-intarea-unicast-127-06. Thank you for the info.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wasn't aware of that I-D, but i accept this as a reason not to remove the feature :-)

return IN6_IS_ADDR_LOOPBACK(&addr->v6);
default:
Expand Down
2 changes: 2 additions & 0 deletions sys/netpfil/pf/pf_norm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2224,12 +2224,14 @@
}

/* random-id, but not for fragments */
#ifdef INET
if (pd->af == AF_INET &&
pd->act.flags & PFSTATE_RANDOMID && !(h->ip_off & ~htons(IP_DF))) {
uint16_t ip_id = h->ip_id;

ip_fillid(h);
h->ip_sum = pf_cksum_fixup(h->ip_sum, ip_id, h->ip_id, 0);
}
#endif
}
#endif

Check warning on line 2237 in sys/netpfil/pf/pf_norm.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line
Loading