summaryrefslogtreecommitdiffstats
path: root/sys/net/pf_osfp.c
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2011-09-19 12:51:52 +0000
committerbluhm <bluhm@openbsd.org>2011-09-19 12:51:52 +0000
commit110e53770d136c90a07e61bf0a447a8a00eef6dc (patch)
tree62d28b998c9344509e6ff9d234806d7e002858ab /sys/net/pf_osfp.c
parentsync (diff)
downloadwireguard-openbsd-110e53770d136c90a07e61bf0a447a8a00eef6dc.tar.xz
wireguard-openbsd-110e53770d136c90a07e61bf0a447a8a00eef6dc.zip
Consolidate pf function parameters. Move off and hdrlen into pdesc
and change their type from int to u_int32_t. Do not pass struct tcphdr *th and sa_family_t af, it is in pd anyway. Do not use af and pd->af intermixed, the latter makes clear where it comes from. Do not calculate the packet length again if pd already has it. Use pd2.off instead of off2. go go go go don't stop henning@ mpf@
Diffstat (limited to 'sys/net/pf_osfp.c')
-rw-r--r--sys/net/pf_osfp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/net/pf_osfp.c b/sys/net/pf_osfp.c
index 853ea1ce73f..7f934a88285 100644
--- a/sys/net/pf_osfp.c
+++ b/sys/net/pf_osfp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_osfp.c,v 1.21 2010/10/18 15:55:28 deraadt Exp $ */
+/* $OpenBSD: pf_osfp.c,v 1.22 2011/09/19 12:51:52 bluhm Exp $ */
/*
* Copyright (c) 2003 Mike Frantzen <frantzen@w4g.org>
@@ -82,15 +82,15 @@ void pf_osfp_insert(struct pf_osfp_list *,
* Returns the list of possible OSes.
*/
struct pf_osfp_enlist *
-pf_osfp_fingerprint(struct pf_pdesc *pd, struct mbuf *m, int off,
- const struct tcphdr *tcp)
+pf_osfp_fingerprint(struct pf_pdesc *pd, struct mbuf *m)
{
+ struct tcphdr *th = pd->hdr.tcp;
struct ip *ip;
struct ip6_hdr *ip6;
char hdr[60];
if ((pd->af != PF_INET && pd->af != PF_INET6) ||
- pd->proto != IPPROTO_TCP || (tcp->th_off << 2) < sizeof(*tcp))
+ pd->proto != IPPROTO_TCP || (th->th_off << 2) < sizeof(*th))
return (NULL);
if (pd->af == PF_INET) {
@@ -100,8 +100,8 @@ pf_osfp_fingerprint(struct pf_pdesc *pd, struct mbuf *m, int off,
ip = (struct ip *)NULL;
ip6 = mtod(m, struct ip6_hdr *);
}
- if (!pf_pull_hdr(m, off, hdr, tcp->th_off << 2, NULL, NULL,
- pd->af)) return (NULL);
+ if (!pf_pull_hdr(m, pd->off, hdr, th->th_off << 2, NULL, NULL, pd->af))
+ return (NULL);
return (pf_osfp_fingerprint_hdr(ip, ip6, (struct tcphdr *)hdr));
}