1 /* $OpenBSD: pf_osfp.c,v 1.15 2008/06/14 02:22:13 henning Exp $ */ 2 3 /* 4 * Copyright (c) 2003 Mike Frantzen <frantzen@w4g.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 * 18 */ 19 20 #ifdef _KERNEL 21 #include "opt_inet6.h" 22 #endif 23 24 #include <sys/param.h> 25 #include <sys/socket.h> 26 #ifdef _KERNEL 27 #include <sys/systm.h> 28 #include <sys/malloc.h> 29 #endif /* _KERNEL */ 30 #include <sys/mbuf.h> 31 32 #include <netinet/in.h> 33 #include <netinet/in_systm.h> 34 #include <netinet/ip.h> 35 #include <netinet/tcp.h> 36 37 #include <net/if.h> 38 #include <net/pf/pfvar.h> 39 40 #include <netinet/ip6.h> 41 #ifdef _KERNEL 42 #include <netinet6/in6_var.h> 43 #endif 44 45 46 #ifdef _KERNEL 47 # define DPFPRINTF(format, x...) \ 48 if (pf_status.debug >= PF_DEBUG_NOISY) \ 49 kprintf(format , ##x) 50 51 #else 52 /* Userland equivalents so we can lend code to tcpdump et al. */ 53 54 # include <arpa/inet.h> 55 # include <errno.h> 56 # include <stdio.h> 57 # include <stdlib.h> 58 # include <string.h> 59 # include <netdb.h> 60 61 # ifdef PFDEBUG 62 # include <sys/stdarg.h> 63 # define DPFPRINTF(format, x...) fprintf(stderr, format , ##x) 64 # else 65 # define DPFPRINTF(format, x...) ((void)0) 66 # endif /* PFDEBUG */ 67 #endif /* _KERNEL */ 68 69 static MALLOC_DEFINE(M_PFOSFPENTRYPL, "pfospfen", "pf OS finger printing pool list"); 70 static MALLOC_DEFINE(M_PFOSFPPL, "pfosfp", "pf OS finger printing pool list"); 71 72 SLIST_HEAD(pf_osfp_list, pf_os_fingerprint) pf_osfp_list; 73 74 struct pf_os_fingerprint *pf_osfp_find(struct pf_osfp_list *, 75 struct pf_os_fingerprint *, u_int8_t); 76 struct pf_os_fingerprint *pf_osfp_find_exact(struct pf_osfp_list *, 77 struct pf_os_fingerprint *); 78 void pf_osfp_insert(struct pf_osfp_list *, 79 struct pf_os_fingerprint *); 80 81 82 #ifdef _KERNEL 83 /* 84 * Passively fingerprint the OS of the host (IPv4 TCP SYN packets only) 85 * Returns the list of possible OSes. 86 */ 87 struct pf_osfp_enlist * 88 pf_osfp_fingerprint(struct pf_pdesc *pd, struct mbuf *m, int off, 89 const struct tcphdr *tcp) 90 { 91 struct ip *ip; 92 struct ip6_hdr *ip6; 93 char hdr[60]; 94 95 if ((pd->af != PF_INET && pd->af != PF_INET6) || 96 pd->proto != IPPROTO_TCP || (tcp->th_off << 2) < sizeof(*tcp)) 97 return (NULL); 98 99 if (pd->af == PF_INET) { 100 ip = mtod(m, struct ip *); 101 ip6 = NULL; 102 } else { 103 ip = NULL; 104 ip6 = mtod(m, struct ip6_hdr *); 105 } 106 if (!pf_pull_hdr(m, off, hdr, tcp->th_off << 2, NULL, NULL, 107 pd->af)) return (NULL); 108 109 return (pf_osfp_fingerprint_hdr(ip, ip6, (struct tcphdr *)hdr)); 110 } 111 #endif /* _KERNEL */ 112 113 struct pf_osfp_enlist * 114 pf_osfp_fingerprint_hdr(const struct ip *ip, const struct ip6_hdr *ip6, const struct tcphdr *tcp) 115 { 116 struct pf_os_fingerprint fp, *fpresult; 117 int cnt, optlen = 0; 118 const u_int8_t *optp; 119 #ifdef _KERNEL 120 char srcname[128]; 121 #else 122 char srcname[NI_MAXHOST]; 123 #endif 124 125 if ((tcp->th_flags & (TH_SYN|TH_ACK)) != TH_SYN) 126 return (NULL); 127 if (ip) { 128 if ((ip->ip_off & IP_OFFMASK) != 0) 129 return (NULL); 130 } 131 132 memset(&fp, 0, sizeof(fp)); 133 134 if (ip) { 135 #ifndef _KERNEL 136 struct sockaddr_in sin; 137 #endif 138 139 fp.fp_psize = ip->ip_len; 140 fp.fp_ttl = ip->ip_ttl; 141 if (ip->ip_off & IP_DF) 142 fp.fp_flags |= PF_OSFP_DF; 143 #ifdef _KERNEL 144 kinet_ntoa(ip->ip_src, srcname); 145 #else 146 memset(&sin, 0, sizeof(sin)); 147 sin.sin_family = AF_INET; 148 sin.sin_len = sizeof(struct sockaddr_in); 149 sin.sin_addr = ip->ip_src; 150 (void)getnameinfo((struct sockaddr *)&sin, 151 sizeof(struct sockaddr_in), srcname, sizeof(srcname), 152 NULL, 0, NI_NUMERICHOST); 153 #endif 154 } 155 #ifdef INET6 156 else if (ip6) { 157 #ifndef _KERNEL 158 struct sockaddr_in6 sin6; 159 #endif 160 161 /* jumbo payload? */ 162 fp.fp_psize = sizeof(struct ip6_hdr) + ntohs(ip6->ip6_plen); 163 fp.fp_ttl = ip6->ip6_hlim; 164 fp.fp_flags |= PF_OSFP_DF; 165 fp.fp_flags |= PF_OSFP_INET6; 166 #ifdef _KERNEL 167 strlcpy(srcname, ip6_sprintf(&ip6->ip6_src), sizeof(srcname)); 168 #else 169 memset(&sin6, 0, sizeof(sin6)); 170 sin6.sin6_family = AF_INET6; 171 sin6.sin6_len = sizeof(struct sockaddr_in6); 172 sin6.sin6_addr = ip6->ip6_src; 173 (void)getnameinfo((struct sockaddr *)&sin6, 174 sizeof(struct sockaddr_in6), srcname, sizeof(srcname), 175 NULL, 0, NI_NUMERICHOST); 176 #endif 177 } 178 #endif 179 else 180 return (NULL); 181 fp.fp_wsize = ntohs(tcp->th_win); 182 183 184 cnt = (tcp->th_off << 2) - sizeof(*tcp); 185 optp = (const u_int8_t *)((const char *)tcp + sizeof(*tcp)); 186 for (; cnt > 0; cnt -= optlen, optp += optlen) { 187 if (*optp == TCPOPT_EOL) 188 break; 189 190 fp.fp_optcnt++; 191 if (*optp == TCPOPT_NOP) { 192 fp.fp_tcpopts = (fp.fp_tcpopts << PF_OSFP_TCPOPT_BITS) | 193 PF_OSFP_TCPOPT_NOP; 194 optlen = 1; 195 } else { 196 if (cnt < 2) 197 return (NULL); 198 optlen = optp[1]; 199 if (optlen > cnt || optlen < 2) 200 return (NULL); 201 switch (*optp) { 202 case TCPOPT_MAXSEG: 203 if (optlen >= TCPOLEN_MAXSEG) 204 memcpy(&fp.fp_mss, &optp[2], 205 sizeof(fp.fp_mss)); 206 fp.fp_tcpopts = (fp.fp_tcpopts << 207 PF_OSFP_TCPOPT_BITS) | PF_OSFP_TCPOPT_MSS; 208 fp.fp_mss = ntohs(fp.fp_mss); 209 break; 210 case TCPOPT_WINDOW: 211 if (optlen >= TCPOLEN_WINDOW) 212 memcpy(&fp.fp_wscale, &optp[2], 213 sizeof(fp.fp_wscale)); 214 fp.fp_tcpopts = (fp.fp_tcpopts << 215 PF_OSFP_TCPOPT_BITS) | 216 PF_OSFP_TCPOPT_WSCALE; 217 break; 218 case TCPOPT_SACK_PERMITTED: 219 fp.fp_tcpopts = (fp.fp_tcpopts << 220 PF_OSFP_TCPOPT_BITS) | PF_OSFP_TCPOPT_SACK; 221 break; 222 case TCPOPT_TIMESTAMP: 223 if (optlen >= TCPOLEN_TIMESTAMP) { 224 u_int32_t ts; 225 memcpy(&ts, &optp[2], sizeof(ts)); 226 if (ts == 0) 227 fp.fp_flags |= PF_OSFP_TS0; 228 229 } 230 fp.fp_tcpopts = (fp.fp_tcpopts << 231 PF_OSFP_TCPOPT_BITS) | PF_OSFP_TCPOPT_TS; 232 break; 233 default: 234 return (NULL); 235 } 236 } 237 optlen = MAX(optlen, 1); /* paranoia */ 238 } 239 240 DPFPRINTF("fingerprinted %s:%d %d:%d:%d:%d:%llx (%d) " 241 "(TS=%s,M=%s%d,W=%s%d)\n", 242 srcname, ntohs(tcp->th_sport), 243 fp.fp_wsize, fp.fp_ttl, (fp.fp_flags & PF_OSFP_DF) != 0, 244 fp.fp_psize, (long long int)fp.fp_tcpopts, fp.fp_optcnt, 245 (fp.fp_flags & PF_OSFP_TS0) ? "0" : "", 246 (fp.fp_flags & PF_OSFP_MSS_MOD) ? "%" : 247 (fp.fp_flags & PF_OSFP_MSS_DC) ? "*" : "", 248 fp.fp_mss, 249 (fp.fp_flags & PF_OSFP_WSCALE_MOD) ? "%" : 250 (fp.fp_flags & PF_OSFP_WSCALE_DC) ? "*" : "", 251 fp.fp_wscale); 252 253 if ((fpresult = pf_osfp_find(&pf_osfp_list, &fp, 254 PF_OSFP_MAXTTL_OFFSET))) 255 return (&fpresult->fp_oses); 256 return (NULL); 257 } 258 259 /* Match a fingerprint ID against a list of OSes */ 260 int 261 pf_osfp_match(struct pf_osfp_enlist *list, pf_osfp_t os) 262 { 263 struct pf_osfp_entry *entry; 264 int os_class, os_version, os_subtype; 265 int en_class, en_version, en_subtype; 266 267 if (os == PF_OSFP_ANY) 268 return (1); 269 if (list == NULL) { 270 DPFPRINTF("osfp no match against %x\n", os); 271 return (os == PF_OSFP_UNKNOWN); 272 } 273 PF_OSFP_UNPACK(os, os_class, os_version, os_subtype); 274 SLIST_FOREACH(entry, list, fp_entry) { 275 PF_OSFP_UNPACK(entry->fp_os, en_class, en_version, en_subtype); 276 if ((os_class == PF_OSFP_ANY || en_class == os_class) && 277 (os_version == PF_OSFP_ANY || en_version == os_version) && 278 (os_subtype == PF_OSFP_ANY || en_subtype == os_subtype)) { 279 DPFPRINTF("osfp matched %s %s %s %x==%x\n", 280 entry->fp_class_nm, entry->fp_version_nm, 281 entry->fp_subtype_nm, os, entry->fp_os); 282 return (1); 283 } 284 } 285 DPFPRINTF("fingerprint 0x%x didn't match\n", os); 286 return (0); 287 } 288 289 /* Initialize the OS fingerprint system */ 290 void 291 pf_osfp_initialize(void) 292 { 293 SLIST_INIT(&pf_osfp_list); 294 } 295 296 /* Flush the fingerprint list */ 297 void 298 pf_osfp_flush(void) 299 { 300 struct pf_os_fingerprint *fp; 301 struct pf_osfp_entry *entry; 302 303 while ((fp = SLIST_FIRST(&pf_osfp_list))) { 304 SLIST_REMOVE_HEAD(&pf_osfp_list, fp_next); 305 while ((entry = SLIST_FIRST(&fp->fp_oses))) { 306 SLIST_REMOVE_HEAD(&fp->fp_oses, fp_entry); 307 kfree(entry, M_PFOSFPENTRYPL); 308 } 309 kfree(fp, M_PFOSFPPL); 310 } 311 } 312 313 314 /* Add a fingerprint */ 315 int 316 pf_osfp_add(struct pf_osfp_ioctl *fpioc) 317 { 318 struct pf_os_fingerprint *fp, fpadd; 319 struct pf_osfp_entry *entry; 320 321 memset(&fpadd, 0, sizeof(fpadd)); 322 fpadd.fp_tcpopts = fpioc->fp_tcpopts; 323 fpadd.fp_wsize = fpioc->fp_wsize; 324 fpadd.fp_psize = fpioc->fp_psize; 325 fpadd.fp_mss = fpioc->fp_mss; 326 fpadd.fp_flags = fpioc->fp_flags; 327 fpadd.fp_optcnt = fpioc->fp_optcnt; 328 fpadd.fp_wscale = fpioc->fp_wscale; 329 fpadd.fp_ttl = fpioc->fp_ttl; 330 331 #if 0 /* XXX RYAN wants to fix logging */ 332 DPFPRINTF("adding osfp %s %s %s = %s%d:%d:%d:%s%d:0x%llx %d " 333 "(TS=%s,M=%s%d,W=%s%d) %x\n", 334 fpioc->fp_os.fp_class_nm, fpioc->fp_os.fp_version_nm, 335 fpioc->fp_os.fp_subtype_nm, 336 (fpadd.fp_flags & PF_OSFP_WSIZE_MOD) ? "%" : 337 (fpadd.fp_flags & PF_OSFP_WSIZE_MSS) ? "S" : 338 (fpadd.fp_flags & PF_OSFP_WSIZE_MTU) ? "T" : 339 (fpadd.fp_flags & PF_OSFP_WSIZE_DC) ? "*" : "", 340 fpadd.fp_wsize, 341 fpadd.fp_ttl, 342 (fpadd.fp_flags & PF_OSFP_DF) ? 1 : 0, 343 (fpadd.fp_flags & PF_OSFP_PSIZE_MOD) ? "%" : 344 (fpadd.fp_flags & PF_OSFP_PSIZE_DC) ? "*" : "", 345 fpadd.fp_psize, 346 (long long int)fpadd.fp_tcpopts, fpadd.fp_optcnt, 347 (fpadd.fp_flags & PF_OSFP_TS0) ? "0" : "", 348 (fpadd.fp_flags & PF_OSFP_MSS_MOD) ? "%" : 349 (fpadd.fp_flags & PF_OSFP_MSS_DC) ? "*" : "", 350 fpadd.fp_mss, 351 (fpadd.fp_flags & PF_OSFP_WSCALE_MOD) ? "%" : 352 (fpadd.fp_flags & PF_OSFP_WSCALE_DC) ? "*" : "", 353 fpadd.fp_wscale, 354 fpioc->fp_os.fp_os); 355 #endif 356 357 if ((fp = pf_osfp_find_exact(&pf_osfp_list, &fpadd))) { 358 SLIST_FOREACH(entry, &fp->fp_oses, fp_entry) { 359 if (PF_OSFP_ENTRY_EQ(entry, &fpioc->fp_os)) 360 return (EEXIST); 361 } 362 if ((entry = kmalloc(sizeof(struct pf_osfp_entry), 363 M_PFOSFPENTRYPL, M_WAITOK|M_NULLOK)) == NULL) 364 return (ENOMEM); 365 } else { 366 if ((fp = kmalloc(sizeof(struct pf_os_fingerprint), 367 M_PFOSFPPL, M_WAITOK|M_NULLOK)) == NULL) 368 return (ENOMEM); 369 memset(fp, 0, sizeof(*fp)); 370 fp->fp_tcpopts = fpioc->fp_tcpopts; 371 fp->fp_wsize = fpioc->fp_wsize; 372 fp->fp_psize = fpioc->fp_psize; 373 fp->fp_mss = fpioc->fp_mss; 374 fp->fp_flags = fpioc->fp_flags; 375 fp->fp_optcnt = fpioc->fp_optcnt; 376 fp->fp_wscale = fpioc->fp_wscale; 377 fp->fp_ttl = fpioc->fp_ttl; 378 SLIST_INIT(&fp->fp_oses); 379 if ((entry = kmalloc(sizeof(struct pf_osfp_entry), 380 M_PFOSFPENTRYPL, M_WAITOK|M_NULLOK)) == NULL) { 381 kfree(fp, M_PFOSFPPL); 382 return (ENOMEM); 383 } 384 pf_osfp_insert(&pf_osfp_list, fp); 385 } 386 memcpy(entry, &fpioc->fp_os, sizeof(*entry)); 387 388 /* Make sure the strings are NUL terminated */ 389 entry->fp_class_nm[sizeof(entry->fp_class_nm)-1] = '\0'; 390 entry->fp_version_nm[sizeof(entry->fp_version_nm)-1] = '\0'; 391 entry->fp_subtype_nm[sizeof(entry->fp_subtype_nm)-1] = '\0'; 392 393 SLIST_INSERT_HEAD(&fp->fp_oses, entry, fp_entry); 394 395 #ifdef PFDEBUG 396 if ((fp = pf_osfp_validate())) 397 kprintf("Invalid fingerprint list\n"); 398 #endif /* PFDEBUG */ 399 return (0); 400 } 401 402 403 /* Find a fingerprint in the list */ 404 struct pf_os_fingerprint * 405 pf_osfp_find(struct pf_osfp_list *list, struct pf_os_fingerprint *find, 406 u_int8_t ttldiff) 407 { 408 struct pf_os_fingerprint *f; 409 410 #define MATCH_INT(_MOD, _DC, _field) \ 411 if ((f->fp_flags & _DC) == 0) { \ 412 if ((f->fp_flags & _MOD) == 0) { \ 413 if (f->_field != find->_field) \ 414 continue; \ 415 } else { \ 416 if (f->_field == 0 || find->_field % f->_field) \ 417 continue; \ 418 } \ 419 } 420 421 SLIST_FOREACH(f, list, fp_next) { 422 if (f->fp_tcpopts != find->fp_tcpopts || 423 f->fp_optcnt != find->fp_optcnt || 424 f->fp_ttl < find->fp_ttl || 425 f->fp_ttl - find->fp_ttl > ttldiff || 426 (f->fp_flags & (PF_OSFP_DF|PF_OSFP_TS0)) != 427 (find->fp_flags & (PF_OSFP_DF|PF_OSFP_TS0))) 428 continue; 429 430 MATCH_INT(PF_OSFP_PSIZE_MOD, PF_OSFP_PSIZE_DC, fp_psize) 431 MATCH_INT(PF_OSFP_MSS_MOD, PF_OSFP_MSS_DC, fp_mss) 432 MATCH_INT(PF_OSFP_WSCALE_MOD, PF_OSFP_WSCALE_DC, fp_wscale) 433 if ((f->fp_flags & PF_OSFP_WSIZE_DC) == 0) { 434 if (f->fp_flags & PF_OSFP_WSIZE_MSS) { 435 if (find->fp_mss == 0) 436 continue; 437 438 /* Some "smart" NAT devices and DSL routers will tweak the MSS size and 439 * will set it to whatever is suitable for the link type. 440 */ 441 #define SMART_MSS 1460 442 if ((find->fp_wsize % find->fp_mss || 443 find->fp_wsize / find->fp_mss != 444 f->fp_wsize) && 445 (find->fp_wsize % SMART_MSS || 446 find->fp_wsize / SMART_MSS != 447 f->fp_wsize)) 448 continue; 449 } else if (f->fp_flags & PF_OSFP_WSIZE_MTU) { 450 if (find->fp_mss == 0) 451 continue; 452 453 #define MTUOFF (sizeof(struct ip) + sizeof(struct tcphdr)) 454 #define SMART_MTU (SMART_MSS + MTUOFF) 455 if ((find->fp_wsize % (find->fp_mss + MTUOFF) || 456 find->fp_wsize / (find->fp_mss + MTUOFF) != 457 f->fp_wsize) && 458 (find->fp_wsize % SMART_MTU || 459 find->fp_wsize / SMART_MTU != 460 f->fp_wsize)) 461 continue; 462 } else if (f->fp_flags & PF_OSFP_WSIZE_MOD) { 463 if (f->fp_wsize == 0 || find->fp_wsize % 464 f->fp_wsize) 465 continue; 466 } else { 467 if (f->fp_wsize != find->fp_wsize) 468 continue; 469 } 470 } 471 return (f); 472 } 473 474 return (NULL); 475 } 476 477 /* Find an exact fingerprint in the list */ 478 struct pf_os_fingerprint * 479 pf_osfp_find_exact(struct pf_osfp_list *list, struct pf_os_fingerprint *find) 480 { 481 struct pf_os_fingerprint *f; 482 483 SLIST_FOREACH(f, list, fp_next) { 484 if (f->fp_tcpopts == find->fp_tcpopts && 485 f->fp_wsize == find->fp_wsize && 486 f->fp_psize == find->fp_psize && 487 f->fp_mss == find->fp_mss && 488 f->fp_flags == find->fp_flags && 489 f->fp_optcnt == find->fp_optcnt && 490 f->fp_wscale == find->fp_wscale && 491 f->fp_ttl == find->fp_ttl) 492 return (f); 493 } 494 495 return (NULL); 496 } 497 498 /* Insert a fingerprint into the list */ 499 void 500 pf_osfp_insert(struct pf_osfp_list *list, struct pf_os_fingerprint *ins) 501 { 502 struct pf_os_fingerprint *f, *prev = NULL; 503 504 /* XXX need to go semi tree based. can key on tcp options */ 505 506 SLIST_FOREACH(f, list, fp_next) 507 prev = f; 508 if (prev) 509 SLIST_INSERT_AFTER(prev, ins, fp_next); 510 else 511 SLIST_INSERT_HEAD(list, ins, fp_next); 512 } 513 514 /* Fill a fingerprint by its number (from an ioctl) */ 515 int 516 pf_osfp_get(struct pf_osfp_ioctl *fpioc) 517 { 518 struct pf_os_fingerprint *fp; 519 struct pf_osfp_entry *entry; 520 int num = fpioc->fp_getnum; 521 int i = 0; 522 523 524 memset(fpioc, 0, sizeof(*fpioc)); 525 SLIST_FOREACH(fp, &pf_osfp_list, fp_next) { 526 SLIST_FOREACH(entry, &fp->fp_oses, fp_entry) { 527 if (i++ == num) { 528 fpioc->fp_mss = fp->fp_mss; 529 fpioc->fp_wsize = fp->fp_wsize; 530 fpioc->fp_flags = fp->fp_flags; 531 fpioc->fp_psize = fp->fp_psize; 532 fpioc->fp_ttl = fp->fp_ttl; 533 fpioc->fp_wscale = fp->fp_wscale; 534 fpioc->fp_getnum = num; 535 memcpy(&fpioc->fp_os, entry, 536 sizeof(fpioc->fp_os)); 537 return (0); 538 } 539 } 540 } 541 542 return (EBUSY); 543 } 544 545 546 /* Validate that each signature is reachable */ 547 struct pf_os_fingerprint * 548 pf_osfp_validate(void) 549 { 550 struct pf_os_fingerprint *f, *f2, find; 551 552 SLIST_FOREACH(f, &pf_osfp_list, fp_next) { 553 memcpy(&find, f, sizeof(find)); 554 555 /* We do a few MSS/th_win percolations to make things unique */ 556 if (find.fp_mss == 0) 557 find.fp_mss = 128; 558 if (f->fp_flags & PF_OSFP_WSIZE_MSS) 559 find.fp_wsize *= find.fp_mss; 560 else if (f->fp_flags & PF_OSFP_WSIZE_MTU) 561 find.fp_wsize *= (find.fp_mss + 40); 562 else if (f->fp_flags & PF_OSFP_WSIZE_MOD) 563 find.fp_wsize *= 2; 564 if (f != (f2 = pf_osfp_find(&pf_osfp_list, &find, 0))) { 565 if (f2) 566 kprintf("Found \"%s %s %s\" instead of " 567 "\"%s %s %s\"\n", 568 SLIST_FIRST(&f2->fp_oses)->fp_class_nm, 569 SLIST_FIRST(&f2->fp_oses)->fp_version_nm, 570 SLIST_FIRST(&f2->fp_oses)->fp_subtype_nm, 571 SLIST_FIRST(&f->fp_oses)->fp_class_nm, 572 SLIST_FIRST(&f->fp_oses)->fp_version_nm, 573 SLIST_FIRST(&f->fp_oses)->fp_subtype_nm); 574 else 575 kprintf("Couldn't find \"%s %s %s\"\n", 576 SLIST_FIRST(&f->fp_oses)->fp_class_nm, 577 SLIST_FIRST(&f->fp_oses)->fp_version_nm, 578 SLIST_FIRST(&f->fp_oses)->fp_subtype_nm); 579 return (f); 580 } 581 } 582 return (NULL); 583 } 584