]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/net/pf_osfp.c
xnu-3789.70.16.tar.gz
[apple/xnu.git] / bsd / net / pf_osfp.c
index fcd823cfae3489ca279a469b0d37ffc57d9a1858..e04a94e0fd6aa634ad48ffcfe1199f32d19999c4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  *
@@ -109,7 +109,7 @@ pf_osfp_fingerprint(struct pf_pdesc *pd, struct mbuf *m, int off,
            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 *
@@ -312,7 +312,7 @@ int
 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;
@@ -324,6 +324,12 @@ pf_osfp_add(struct pf_osfp_ioctl *fpioc)
        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,
@@ -527,6 +533,7 @@ pf_osfp_get(struct pf_osfp_ioctl *fpioc)
                                fpioc->fp_getnum = num;
                                memcpy(&fpioc->fp_os, entry,
                                    sizeof (fpioc->fp_os));
+                               fpioc->fp_os.fp_entry.sle_next = NULL;
                                return (0);
                        }
                }
@@ -549,7 +556,7 @@ pf_osfp_validate(void)
                if (find.fp_mss == 0)
                        find.fp_mss = 128;
                if (f->fp_flags & PF_OSFP_WSIZE_MSS)
-                       find.fp_wsize *= find.fp_mss, 1;
+                       find.fp_wsize *= find.fp_mss;
                else if (f->fp_flags & PF_OSFP_WSIZE_MTU)
                        find.fp_wsize *= (find.fp_mss + 40);
                else if (f->fp_flags & PF_OSFP_WSIZE_MOD)