/*
- * Copyright (c) 2007-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2011 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* Returns the list of possible OSes.
*/
struct pf_osfp_enlist *
-pf_osfp_fingerprint(struct pf_pdesc *pd, struct mbuf *m, int off,
+pf_osfp_fingerprint(struct pf_pdesc *pd, pbuf_t *pbuf, int off,
const struct tcphdr *tcp)
{
struct ip *ip;
return (NULL);
if (pd->af == PF_INET) {
- ip = mtod(m, struct ip *);
+ ip = pbuf->pb_data;
ip6 = (struct ip6_hdr *)NULL;
} else {
ip = (struct ip *)NULL;
- ip6 = mtod(m, struct ip6_hdr *);
+ ip6 = pbuf->pb_data;
}
- if (!pf_pull_hdr(m, off, hdr, tcp->th_off << 2, NULL, NULL,
+ if (!pf_pull_hdr(pbuf, off, hdr, tcp->th_off << 2, NULL, NULL,
pd->af))
return (NULL);
- return (pf_osfp_fingerprint_hdr(ip, ip6, (struct tcphdr *)hdr));
+ return (pf_osfp_fingerprint_hdr(ip, ip6, (struct tcphdr *)(void *)hdr));
}
struct pf_osfp_enlist *
pf_osfp_add(struct pf_osfp_ioctl *fpioc)
{
struct pf_os_fingerprint *fp, fpadd;
- struct pf_osfp_entry *entry;
+ struct pf_osfp_entry *entry, *uentry;
memset(&fpadd, 0, sizeof (fpadd));
fpadd.fp_tcpopts = fpioc->fp_tcpopts;
fpadd.fp_wscale = fpioc->fp_wscale;
fpadd.fp_ttl = fpioc->fp_ttl;
+ uentry = &fpioc->fp_os;
+ uentry->fp_entry.sle_next = NULL;
+ uentry->fp_class_nm[sizeof (uentry->fp_class_nm) - 1] = '\0';
+ uentry->fp_version_nm[sizeof (uentry->fp_version_nm) - 1] = '\0';
+ uentry->fp_subtype_nm[sizeof (uentry->fp_subtype_nm) - 1] = '\0';
+
DPFPRINTF("adding osfp %s %s %s = %s%d:%d:%d:%s%d:0x%llx %d "
"(TS=%s,M=%s%d,W=%s%d) %x\n",
fpioc->fp_os.fp_class_nm, fpioc->fp_os.fp_version_nm,
fpioc->fp_getnum = num;
memcpy(&fpioc->fp_os, entry,
sizeof (fpioc->fp_os));
+ fpioc->fp_os.fp_entry.sle_next = NULL;
return (0);
}
}