2012-12-28 09:19:49 +00:00
|
|
|
/*-
|
2017-12-08 15:57:29 +00:00
|
|
|
* SPDX-License-Identifier: ISC
|
|
|
|
*
|
2004-02-26 02:04:28 +00:00
|
|
|
* Copyright (c) 2003 Mike Frantzen <frantzen@w4g.org>
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*
|
2012-12-28 09:19:49 +00:00
|
|
|
* $OpenBSD: pf_osfp.c,v 1.14 2008/06/12 18:17:01 henning Exp $
|
2004-02-26 02:04:28 +00:00
|
|
|
*/
|
|
|
|
|
2007-07-03 12:16:07 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
2017-02-16 20:44:44 +00:00
|
|
|
#include "opt_inet6.h"
|
|
|
|
|
2004-02-26 02:04:28 +00:00
|
|
|
#include <sys/param.h>
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
#include <sys/kernel.h>
|
2013-10-26 17:58:36 +00:00
|
|
|
#include <sys/lock.h>
|
|
|
|
#include <sys/mbuf.h>
|
|
|
|
#include <sys/rwlock.h>
|
2004-02-26 02:04:28 +00:00
|
|
|
#include <sys/socket.h>
|
|
|
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/ip.h>
|
|
|
|
#include <netinet/tcp.h>
|
|
|
|
|
|
|
|
#include <net/if.h>
|
2013-10-26 17:58:36 +00:00
|
|
|
#include <net/vnet.h>
|
2004-02-26 02:04:28 +00:00
|
|
|
#include <net/pfvar.h>
|
|
|
|
|
2017-02-16 20:44:44 +00:00
|
|
|
#ifdef INET6
|
2004-02-26 02:04:28 +00:00
|
|
|
#include <netinet/ip6.h>
|
2017-02-16 20:44:44 +00:00
|
|
|
#endif
|
2011-06-28 11:57:25 +00:00
|
|
|
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
static MALLOC_DEFINE(M_PFOSFP, "pf_osfp", "pf(4) operating system fingerprints");
|
2011-06-28 11:57:25 +00:00
|
|
|
#define DPFPRINTF(format, x...) \
|
|
|
|
if (V_pf_status.debug >= PF_DEBUG_NOISY) \
|
|
|
|
printf(format , ##x)
|
2004-02-26 02:04:28 +00:00
|
|
|
|
2011-06-28 11:57:25 +00:00
|
|
|
SLIST_HEAD(pf_osfp_list, pf_os_fingerprint);
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
static VNET_DEFINE(struct pf_osfp_list, pf_osfp_list) =
|
|
|
|
SLIST_HEAD_INITIALIZER();
|
2011-06-28 11:57:25 +00:00
|
|
|
#define V_pf_osfp_list VNET(pf_osfp_list)
|
2004-02-26 02:04:28 +00:00
|
|
|
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
static struct pf_osfp_enlist *pf_osfp_fingerprint_hdr(const struct ip *,
|
|
|
|
const struct ip6_hdr *,
|
|
|
|
const struct tcphdr *);
|
|
|
|
static struct pf_os_fingerprint *pf_osfp_find(struct pf_osfp_list *,
|
2004-02-26 02:04:28 +00:00
|
|
|
struct pf_os_fingerprint *, u_int8_t);
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
static struct pf_os_fingerprint *pf_osfp_find_exact(struct pf_osfp_list *,
|
2004-02-26 02:04:28 +00:00
|
|
|
struct pf_os_fingerprint *);
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
static void pf_osfp_insert(struct pf_osfp_list *,
|
2004-02-26 02:04:28 +00:00
|
|
|
struct pf_os_fingerprint *);
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
#ifdef PFDEBUG
|
|
|
|
static struct pf_os_fingerprint *pf_osfp_validate(void);
|
|
|
|
#endif
|
2004-02-26 02:04:28 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Passively fingerprint the OS of the host (IPv4 TCP SYN packets only)
|
|
|
|
* 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)
|
|
|
|
{
|
|
|
|
struct ip *ip;
|
2007-07-03 12:16:07 +00:00
|
|
|
struct ip6_hdr *ip6;
|
2004-02-26 02:04:28 +00:00
|
|
|
char hdr[60];
|
|
|
|
|
2007-07-03 12:16:07 +00:00
|
|
|
if ((pd->af != PF_INET && pd->af != PF_INET6) ||
|
|
|
|
pd->proto != IPPROTO_TCP || (tcp->th_off << 2) < sizeof(*tcp))
|
2004-02-26 02:04:28 +00:00
|
|
|
return (NULL);
|
|
|
|
|
2007-07-03 12:16:07 +00:00
|
|
|
if (pd->af == PF_INET) {
|
|
|
|
ip = mtod(m, struct ip *);
|
|
|
|
ip6 = (struct ip6_hdr *)NULL;
|
|
|
|
} else {
|
|
|
|
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);
|
2004-02-26 02:04:28 +00:00
|
|
|
|
2007-07-03 12:16:07 +00:00
|
|
|
return (pf_osfp_fingerprint_hdr(ip, ip6, (struct tcphdr *)hdr));
|
2004-02-26 02:04:28 +00:00
|
|
|
}
|
|
|
|
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
static struct pf_osfp_enlist *
|
2007-07-03 12:16:07 +00:00
|
|
|
pf_osfp_fingerprint_hdr(const struct ip *ip, const struct ip6_hdr *ip6, const struct tcphdr *tcp)
|
2004-02-26 02:04:28 +00:00
|
|
|
{
|
|
|
|
struct pf_os_fingerprint fp, *fpresult;
|
|
|
|
int cnt, optlen = 0;
|
2004-02-26 02:34:12 +00:00
|
|
|
const u_int8_t *optp;
|
2017-02-16 20:44:44 +00:00
|
|
|
#ifdef INET6
|
|
|
|
char srcname[INET6_ADDRSTRLEN];
|
|
|
|
#else
|
|
|
|
char srcname[INET_ADDRSTRLEN];
|
|
|
|
#endif
|
2004-02-26 02:04:28 +00:00
|
|
|
|
2007-07-03 12:16:07 +00:00
|
|
|
if ((tcp->th_flags & (TH_SYN|TH_ACK)) != TH_SYN)
|
2004-02-26 02:04:28 +00:00
|
|
|
return (NULL);
|
2007-07-03 12:16:07 +00:00
|
|
|
if (ip) {
|
|
|
|
if ((ip->ip_off & htons(IP_OFFMASK)) != 0)
|
|
|
|
return (NULL);
|
|
|
|
}
|
2004-02-26 02:04:28 +00:00
|
|
|
|
|
|
|
memset(&fp, 0, sizeof(fp));
|
|
|
|
|
2007-07-03 12:16:07 +00:00
|
|
|
if (ip) {
|
|
|
|
fp.fp_psize = ntohs(ip->ip_len);
|
|
|
|
fp.fp_ttl = ip->ip_ttl;
|
|
|
|
if (ip->ip_off & htons(IP_DF))
|
|
|
|
fp.fp_flags |= PF_OSFP_DF;
|
2017-02-16 20:44:44 +00:00
|
|
|
inet_ntoa_r(ip->ip_src, srcname);
|
2007-07-03 12:16:07 +00:00
|
|
|
}
|
|
|
|
#ifdef INET6
|
|
|
|
else if (ip6) {
|
|
|
|
/* jumbo payload? */
|
|
|
|
fp.fp_psize = sizeof(struct ip6_hdr) + ntohs(ip6->ip6_plen);
|
|
|
|
fp.fp_ttl = ip6->ip6_hlim;
|
2004-02-26 02:04:28 +00:00
|
|
|
fp.fp_flags |= PF_OSFP_DF;
|
2007-07-03 12:16:07 +00:00
|
|
|
fp.fp_flags |= PF_OSFP_INET6;
|
2017-02-16 20:44:44 +00:00
|
|
|
ip6_sprintf(srcname, (const struct in6_addr *)&ip6->ip6_src);
|
2007-07-03 12:16:07 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
else
|
|
|
|
return (NULL);
|
2004-02-26 02:04:28 +00:00
|
|
|
fp.fp_wsize = ntohs(tcp->th_win);
|
|
|
|
|
|
|
|
|
|
|
|
cnt = (tcp->th_off << 2) - sizeof(*tcp);
|
2004-02-26 02:34:12 +00:00
|
|
|
optp = (const u_int8_t *)((const char *)tcp + sizeof(*tcp));
|
2004-02-26 02:04:28 +00:00
|
|
|
for (; cnt > 0; cnt -= optlen, optp += optlen) {
|
|
|
|
if (*optp == TCPOPT_EOL)
|
|
|
|
break;
|
|
|
|
|
|
|
|
fp.fp_optcnt++;
|
|
|
|
if (*optp == TCPOPT_NOP) {
|
|
|
|
fp.fp_tcpopts = (fp.fp_tcpopts << PF_OSFP_TCPOPT_BITS) |
|
|
|
|
PF_OSFP_TCPOPT_NOP;
|
|
|
|
optlen = 1;
|
|
|
|
} else {
|
|
|
|
if (cnt < 2)
|
|
|
|
return (NULL);
|
|
|
|
optlen = optp[1];
|
|
|
|
if (optlen > cnt || optlen < 2)
|
|
|
|
return (NULL);
|
|
|
|
switch (*optp) {
|
|
|
|
case TCPOPT_MAXSEG:
|
|
|
|
if (optlen >= TCPOLEN_MAXSEG)
|
|
|
|
memcpy(&fp.fp_mss, &optp[2],
|
|
|
|
sizeof(fp.fp_mss));
|
|
|
|
fp.fp_tcpopts = (fp.fp_tcpopts <<
|
|
|
|
PF_OSFP_TCPOPT_BITS) | PF_OSFP_TCPOPT_MSS;
|
|
|
|
NTOHS(fp.fp_mss);
|
|
|
|
break;
|
|
|
|
case TCPOPT_WINDOW:
|
|
|
|
if (optlen >= TCPOLEN_WINDOW)
|
|
|
|
memcpy(&fp.fp_wscale, &optp[2],
|
|
|
|
sizeof(fp.fp_wscale));
|
|
|
|
NTOHS(fp.fp_wscale);
|
|
|
|
fp.fp_tcpopts = (fp.fp_tcpopts <<
|
|
|
|
PF_OSFP_TCPOPT_BITS) |
|
|
|
|
PF_OSFP_TCPOPT_WSCALE;
|
|
|
|
break;
|
|
|
|
case TCPOPT_SACK_PERMITTED:
|
|
|
|
fp.fp_tcpopts = (fp.fp_tcpopts <<
|
|
|
|
PF_OSFP_TCPOPT_BITS) | PF_OSFP_TCPOPT_SACK;
|
|
|
|
break;
|
|
|
|
case TCPOPT_TIMESTAMP:
|
|
|
|
if (optlen >= TCPOLEN_TIMESTAMP) {
|
|
|
|
u_int32_t ts;
|
|
|
|
memcpy(&ts, &optp[2], sizeof(ts));
|
|
|
|
if (ts == 0)
|
|
|
|
fp.fp_flags |= PF_OSFP_TS0;
|
|
|
|
|
|
|
|
}
|
|
|
|
fp.fp_tcpopts = (fp.fp_tcpopts <<
|
|
|
|
PF_OSFP_TCPOPT_BITS) | PF_OSFP_TCPOPT_TS;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
optlen = MAX(optlen, 1); /* paranoia */
|
|
|
|
}
|
|
|
|
|
|
|
|
DPFPRINTF("fingerprinted %s:%d %d:%d:%d:%d:%llx (%d) "
|
|
|
|
"(TS=%s,M=%s%d,W=%s%d)\n",
|
2007-07-03 12:16:07 +00:00
|
|
|
srcname, ntohs(tcp->th_sport),
|
2004-02-26 02:04:28 +00:00
|
|
|
fp.fp_wsize, fp.fp_ttl, (fp.fp_flags & PF_OSFP_DF) != 0,
|
|
|
|
fp.fp_psize, (long long int)fp.fp_tcpopts, fp.fp_optcnt,
|
|
|
|
(fp.fp_flags & PF_OSFP_TS0) ? "0" : "",
|
|
|
|
(fp.fp_flags & PF_OSFP_MSS_MOD) ? "%" :
|
|
|
|
(fp.fp_flags & PF_OSFP_MSS_DC) ? "*" : "",
|
|
|
|
fp.fp_mss,
|
|
|
|
(fp.fp_flags & PF_OSFP_WSCALE_MOD) ? "%" :
|
|
|
|
(fp.fp_flags & PF_OSFP_WSCALE_DC) ? "*" : "",
|
|
|
|
fp.fp_wscale);
|
|
|
|
|
2011-06-28 11:57:25 +00:00
|
|
|
if ((fpresult = pf_osfp_find(&V_pf_osfp_list, &fp,
|
2004-02-26 02:04:28 +00:00
|
|
|
PF_OSFP_MAXTTL_OFFSET)))
|
|
|
|
return (&fpresult->fp_oses);
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Match a fingerprint ID against a list of OSes */
|
|
|
|
int
|
|
|
|
pf_osfp_match(struct pf_osfp_enlist *list, pf_osfp_t os)
|
|
|
|
{
|
|
|
|
struct pf_osfp_entry *entry;
|
|
|
|
int os_class, os_version, os_subtype;
|
|
|
|
int en_class, en_version, en_subtype;
|
|
|
|
|
|
|
|
if (os == PF_OSFP_ANY)
|
|
|
|
return (1);
|
|
|
|
if (list == NULL) {
|
|
|
|
DPFPRINTF("osfp no match against %x\n", os);
|
|
|
|
return (os == PF_OSFP_UNKNOWN);
|
|
|
|
}
|
|
|
|
PF_OSFP_UNPACK(os, os_class, os_version, os_subtype);
|
|
|
|
SLIST_FOREACH(entry, list, fp_entry) {
|
|
|
|
PF_OSFP_UNPACK(entry->fp_os, en_class, en_version, en_subtype);
|
|
|
|
if ((os_class == PF_OSFP_ANY || en_class == os_class) &&
|
|
|
|
(os_version == PF_OSFP_ANY || en_version == os_version) &&
|
|
|
|
(os_subtype == PF_OSFP_ANY || en_subtype == os_subtype)) {
|
|
|
|
DPFPRINTF("osfp matched %s %s %s %x==%x\n",
|
|
|
|
entry->fp_class_nm, entry->fp_version_nm,
|
|
|
|
entry->fp_subtype_nm, os, entry->fp_os);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DPFPRINTF("fingerprint 0x%x didn't match\n", os);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Flush the fingerprint list */
|
|
|
|
void
|
|
|
|
pf_osfp_flush(void)
|
|
|
|
{
|
|
|
|
struct pf_os_fingerprint *fp;
|
|
|
|
struct pf_osfp_entry *entry;
|
|
|
|
|
2011-06-28 11:57:25 +00:00
|
|
|
while ((fp = SLIST_FIRST(&V_pf_osfp_list))) {
|
|
|
|
SLIST_REMOVE_HEAD(&V_pf_osfp_list, fp_next);
|
2004-02-26 02:04:28 +00:00
|
|
|
while ((entry = SLIST_FIRST(&fp->fp_oses))) {
|
|
|
|
SLIST_REMOVE_HEAD(&fp->fp_oses, fp_entry);
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
free(entry, M_PFOSFP);
|
2004-02-26 02:04:28 +00:00
|
|
|
}
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
free(fp, M_PFOSFP);
|
2004-02-26 02:04:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Add a fingerprint */
|
|
|
|
int
|
|
|
|
pf_osfp_add(struct pf_osfp_ioctl *fpioc)
|
|
|
|
{
|
|
|
|
struct pf_os_fingerprint *fp, fpadd;
|
|
|
|
struct pf_osfp_entry *entry;
|
|
|
|
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
PF_RULES_WASSERT();
|
|
|
|
|
2004-02-26 02:04:28 +00:00
|
|
|
memset(&fpadd, 0, sizeof(fpadd));
|
|
|
|
fpadd.fp_tcpopts = fpioc->fp_tcpopts;
|
|
|
|
fpadd.fp_wsize = fpioc->fp_wsize;
|
|
|
|
fpadd.fp_psize = fpioc->fp_psize;
|
|
|
|
fpadd.fp_mss = fpioc->fp_mss;
|
|
|
|
fpadd.fp_flags = fpioc->fp_flags;
|
|
|
|
fpadd.fp_optcnt = fpioc->fp_optcnt;
|
|
|
|
fpadd.fp_wscale = fpioc->fp_wscale;
|
|
|
|
fpadd.fp_ttl = fpioc->fp_ttl;
|
|
|
|
|
2011-06-28 11:57:25 +00:00
|
|
|
#if 0 /* XXX RYAN wants to fix logging */
|
2004-02-26 02:04:28 +00:00
|
|
|
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_os.fp_subtype_nm,
|
|
|
|
(fpadd.fp_flags & PF_OSFP_WSIZE_MOD) ? "%" :
|
|
|
|
(fpadd.fp_flags & PF_OSFP_WSIZE_MSS) ? "S" :
|
|
|
|
(fpadd.fp_flags & PF_OSFP_WSIZE_MTU) ? "T" :
|
|
|
|
(fpadd.fp_flags & PF_OSFP_WSIZE_DC) ? "*" : "",
|
|
|
|
fpadd.fp_wsize,
|
|
|
|
fpadd.fp_ttl,
|
|
|
|
(fpadd.fp_flags & PF_OSFP_DF) ? 1 : 0,
|
|
|
|
(fpadd.fp_flags & PF_OSFP_PSIZE_MOD) ? "%" :
|
|
|
|
(fpadd.fp_flags & PF_OSFP_PSIZE_DC) ? "*" : "",
|
|
|
|
fpadd.fp_psize,
|
|
|
|
(long long int)fpadd.fp_tcpopts, fpadd.fp_optcnt,
|
|
|
|
(fpadd.fp_flags & PF_OSFP_TS0) ? "0" : "",
|
|
|
|
(fpadd.fp_flags & PF_OSFP_MSS_MOD) ? "%" :
|
|
|
|
(fpadd.fp_flags & PF_OSFP_MSS_DC) ? "*" : "",
|
|
|
|
fpadd.fp_mss,
|
|
|
|
(fpadd.fp_flags & PF_OSFP_WSCALE_MOD) ? "%" :
|
|
|
|
(fpadd.fp_flags & PF_OSFP_WSCALE_DC) ? "*" : "",
|
|
|
|
fpadd.fp_wscale,
|
|
|
|
fpioc->fp_os.fp_os);
|
2011-06-28 11:57:25 +00:00
|
|
|
#endif
|
2004-02-26 02:04:28 +00:00
|
|
|
|
2011-06-28 11:57:25 +00:00
|
|
|
if ((fp = pf_osfp_find_exact(&V_pf_osfp_list, &fpadd))) {
|
2004-02-26 02:04:28 +00:00
|
|
|
SLIST_FOREACH(entry, &fp->fp_oses, fp_entry) {
|
|
|
|
if (PF_OSFP_ENTRY_EQ(entry, &fpioc->fp_os))
|
|
|
|
return (EEXIST);
|
|
|
|
}
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
if ((entry = malloc(sizeof(*entry), M_PFOSFP, M_NOWAIT))
|
|
|
|
== NULL)
|
2004-02-26 02:04:28 +00:00
|
|
|
return (ENOMEM);
|
|
|
|
} else {
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
if ((fp = malloc(sizeof(*fp), M_PFOSFP, M_ZERO | M_NOWAIT))
|
|
|
|
== NULL)
|
2004-02-26 02:04:28 +00:00
|
|
|
return (ENOMEM);
|
|
|
|
fp->fp_tcpopts = fpioc->fp_tcpopts;
|
|
|
|
fp->fp_wsize = fpioc->fp_wsize;
|
|
|
|
fp->fp_psize = fpioc->fp_psize;
|
|
|
|
fp->fp_mss = fpioc->fp_mss;
|
|
|
|
fp->fp_flags = fpioc->fp_flags;
|
|
|
|
fp->fp_optcnt = fpioc->fp_optcnt;
|
|
|
|
fp->fp_wscale = fpioc->fp_wscale;
|
|
|
|
fp->fp_ttl = fpioc->fp_ttl;
|
|
|
|
SLIST_INIT(&fp->fp_oses);
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
if ((entry = malloc(sizeof(*entry), M_PFOSFP, M_NOWAIT))
|
|
|
|
== NULL) {
|
|
|
|
free(fp, M_PFOSFP);
|
2004-02-26 02:04:28 +00:00
|
|
|
return (ENOMEM);
|
|
|
|
}
|
2011-06-28 11:57:25 +00:00
|
|
|
pf_osfp_insert(&V_pf_osfp_list, fp);
|
2004-02-26 02:04:28 +00:00
|
|
|
}
|
|
|
|
memcpy(entry, &fpioc->fp_os, sizeof(*entry));
|
|
|
|
|
|
|
|
/* Make sure the strings are NUL terminated */
|
|
|
|
entry->fp_class_nm[sizeof(entry->fp_class_nm)-1] = '\0';
|
|
|
|
entry->fp_version_nm[sizeof(entry->fp_version_nm)-1] = '\0';
|
|
|
|
entry->fp_subtype_nm[sizeof(entry->fp_subtype_nm)-1] = '\0';
|
|
|
|
|
|
|
|
SLIST_INSERT_HEAD(&fp->fp_oses, entry, fp_entry);
|
|
|
|
|
|
|
|
#ifdef PFDEBUG
|
|
|
|
if ((fp = pf_osfp_validate()))
|
|
|
|
printf("Invalid fingerprint list\n");
|
|
|
|
#endif /* PFDEBUG */
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Find a fingerprint in the list */
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
static struct pf_os_fingerprint *
|
2004-02-26 02:04:28 +00:00
|
|
|
pf_osfp_find(struct pf_osfp_list *list, struct pf_os_fingerprint *find,
|
|
|
|
u_int8_t ttldiff)
|
|
|
|
{
|
|
|
|
struct pf_os_fingerprint *f;
|
|
|
|
|
2011-06-28 11:57:25 +00:00
|
|
|
#define MATCH_INT(_MOD, _DC, _field) \
|
2004-02-26 02:04:28 +00:00
|
|
|
if ((f->fp_flags & _DC) == 0) { \
|
|
|
|
if ((f->fp_flags & _MOD) == 0) { \
|
|
|
|
if (f->_field != find->_field) \
|
|
|
|
continue; \
|
|
|
|
} else { \
|
|
|
|
if (f->_field == 0 || find->_field % f->_field) \
|
|
|
|
continue; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
SLIST_FOREACH(f, list, fp_next) {
|
|
|
|
if (f->fp_tcpopts != find->fp_tcpopts ||
|
|
|
|
f->fp_optcnt != find->fp_optcnt ||
|
|
|
|
f->fp_ttl < find->fp_ttl ||
|
|
|
|
f->fp_ttl - find->fp_ttl > ttldiff ||
|
|
|
|
(f->fp_flags & (PF_OSFP_DF|PF_OSFP_TS0)) !=
|
|
|
|
(find->fp_flags & (PF_OSFP_DF|PF_OSFP_TS0)))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
MATCH_INT(PF_OSFP_PSIZE_MOD, PF_OSFP_PSIZE_DC, fp_psize)
|
|
|
|
MATCH_INT(PF_OSFP_MSS_MOD, PF_OSFP_MSS_DC, fp_mss)
|
|
|
|
MATCH_INT(PF_OSFP_WSCALE_MOD, PF_OSFP_WSCALE_DC, fp_wscale)
|
|
|
|
if ((f->fp_flags & PF_OSFP_WSIZE_DC) == 0) {
|
|
|
|
if (f->fp_flags & PF_OSFP_WSIZE_MSS) {
|
|
|
|
if (find->fp_mss == 0)
|
|
|
|
continue;
|
|
|
|
|
2011-06-28 11:57:25 +00:00
|
|
|
/*
|
|
|
|
* Some "smart" NAT devices and DSL routers will tweak the MSS size and
|
2004-02-26 02:04:28 +00:00
|
|
|
* will set it to whatever is suitable for the link type.
|
|
|
|
*/
|
2011-06-28 11:57:25 +00:00
|
|
|
#define SMART_MSS 1460
|
2004-02-26 02:04:28 +00:00
|
|
|
if ((find->fp_wsize % find->fp_mss ||
|
|
|
|
find->fp_wsize / find->fp_mss !=
|
|
|
|
f->fp_wsize) &&
|
|
|
|
(find->fp_wsize % SMART_MSS ||
|
|
|
|
find->fp_wsize / SMART_MSS !=
|
|
|
|
f->fp_wsize))
|
|
|
|
continue;
|
|
|
|
} else if (f->fp_flags & PF_OSFP_WSIZE_MTU) {
|
|
|
|
if (find->fp_mss == 0)
|
|
|
|
continue;
|
|
|
|
|
2011-06-28 11:57:25 +00:00
|
|
|
#define MTUOFF (sizeof(struct ip) + sizeof(struct tcphdr))
|
|
|
|
#define SMART_MTU (SMART_MSS + MTUOFF)
|
2004-02-26 02:04:28 +00:00
|
|
|
if ((find->fp_wsize % (find->fp_mss + MTUOFF) ||
|
|
|
|
find->fp_wsize / (find->fp_mss + MTUOFF) !=
|
|
|
|
f->fp_wsize) &&
|
|
|
|
(find->fp_wsize % SMART_MTU ||
|
|
|
|
find->fp_wsize / SMART_MTU !=
|
|
|
|
f->fp_wsize))
|
|
|
|
continue;
|
|
|
|
} else if (f->fp_flags & PF_OSFP_WSIZE_MOD) {
|
|
|
|
if (f->fp_wsize == 0 || find->fp_wsize %
|
|
|
|
f->fp_wsize)
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
if (f->fp_wsize != find->fp_wsize)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (f);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Find an exact fingerprint in the list */
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
static struct pf_os_fingerprint *
|
2004-02-26 02:04:28 +00:00
|
|
|
pf_osfp_find_exact(struct pf_osfp_list *list, struct pf_os_fingerprint *find)
|
|
|
|
{
|
|
|
|
struct pf_os_fingerprint *f;
|
|
|
|
|
|
|
|
SLIST_FOREACH(f, list, fp_next) {
|
|
|
|
if (f->fp_tcpopts == find->fp_tcpopts &&
|
|
|
|
f->fp_wsize == find->fp_wsize &&
|
|
|
|
f->fp_psize == find->fp_psize &&
|
|
|
|
f->fp_mss == find->fp_mss &&
|
|
|
|
f->fp_flags == find->fp_flags &&
|
|
|
|
f->fp_optcnt == find->fp_optcnt &&
|
|
|
|
f->fp_wscale == find->fp_wscale &&
|
|
|
|
f->fp_ttl == find->fp_ttl)
|
|
|
|
return (f);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Insert a fingerprint into the list */
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
static void
|
2004-02-26 02:04:28 +00:00
|
|
|
pf_osfp_insert(struct pf_osfp_list *list, struct pf_os_fingerprint *ins)
|
|
|
|
{
|
|
|
|
struct pf_os_fingerprint *f, *prev = NULL;
|
|
|
|
|
|
|
|
/* XXX need to go semi tree based. can key on tcp options */
|
|
|
|
|
|
|
|
SLIST_FOREACH(f, list, fp_next)
|
|
|
|
prev = f;
|
|
|
|
if (prev)
|
|
|
|
SLIST_INSERT_AFTER(prev, ins, fp_next);
|
|
|
|
else
|
|
|
|
SLIST_INSERT_HEAD(list, ins, fp_next);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Fill a fingerprint by its number (from an ioctl) */
|
|
|
|
int
|
|
|
|
pf_osfp_get(struct pf_osfp_ioctl *fpioc)
|
|
|
|
{
|
|
|
|
struct pf_os_fingerprint *fp;
|
|
|
|
struct pf_osfp_entry *entry;
|
|
|
|
int num = fpioc->fp_getnum;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
|
|
|
|
memset(fpioc, 0, sizeof(*fpioc));
|
2011-06-28 11:57:25 +00:00
|
|
|
SLIST_FOREACH(fp, &V_pf_osfp_list, fp_next) {
|
2004-02-26 02:04:28 +00:00
|
|
|
SLIST_FOREACH(entry, &fp->fp_oses, fp_entry) {
|
|
|
|
if (i++ == num) {
|
|
|
|
fpioc->fp_mss = fp->fp_mss;
|
|
|
|
fpioc->fp_wsize = fp->fp_wsize;
|
|
|
|
fpioc->fp_flags = fp->fp_flags;
|
|
|
|
fpioc->fp_psize = fp->fp_psize;
|
|
|
|
fpioc->fp_ttl = fp->fp_ttl;
|
|
|
|
fpioc->fp_wscale = fp->fp_wscale;
|
|
|
|
fpioc->fp_getnum = num;
|
|
|
|
memcpy(&fpioc->fp_os, entry,
|
|
|
|
sizeof(fpioc->fp_os));
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (EBUSY);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
#ifdef PFDEBUG
|
2004-02-26 02:04:28 +00:00
|
|
|
/* Validate that each signature is reachable */
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
static struct pf_os_fingerprint *
|
2004-02-26 02:04:28 +00:00
|
|
|
pf_osfp_validate(void)
|
|
|
|
{
|
|
|
|
struct pf_os_fingerprint *f, *f2, find;
|
|
|
|
|
2011-06-28 11:57:25 +00:00
|
|
|
SLIST_FOREACH(f, &V_pf_osfp_list, fp_next) {
|
2004-02-26 02:04:28 +00:00
|
|
|
memcpy(&find, f, sizeof(find));
|
|
|
|
|
|
|
|
/* We do a few MSS/th_win percolations to make things unique */
|
|
|
|
if (find.fp_mss == 0)
|
|
|
|
find.fp_mss = 128;
|
|
|
|
if (f->fp_flags & PF_OSFP_WSIZE_MSS)
|
2011-01-14 04:24:53 +00:00
|
|
|
find.fp_wsize *= find.fp_mss;
|
2004-02-26 02:04:28 +00:00
|
|
|
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)
|
|
|
|
find.fp_wsize *= 2;
|
2011-06-28 11:57:25 +00:00
|
|
|
if (f != (f2 = pf_osfp_find(&V_pf_osfp_list, &find, 0))) {
|
2004-02-26 02:04:28 +00:00
|
|
|
if (f2)
|
|
|
|
printf("Found \"%s %s %s\" instead of "
|
|
|
|
"\"%s %s %s\"\n",
|
|
|
|
SLIST_FIRST(&f2->fp_oses)->fp_class_nm,
|
|
|
|
SLIST_FIRST(&f2->fp_oses)->fp_version_nm,
|
|
|
|
SLIST_FIRST(&f2->fp_oses)->fp_subtype_nm,
|
|
|
|
SLIST_FIRST(&f->fp_oses)->fp_class_nm,
|
|
|
|
SLIST_FIRST(&f->fp_oses)->fp_version_nm,
|
|
|
|
SLIST_FIRST(&f->fp_oses)->fp_subtype_nm);
|
|
|
|
else
|
|
|
|
printf("Couldn't find \"%s %s %s\"\n",
|
|
|
|
SLIST_FIRST(&f->fp_oses)->fp_class_nm,
|
|
|
|
SLIST_FIRST(&f->fp_oses)->fp_version_nm,
|
|
|
|
SLIST_FIRST(&f->fp_oses)->fp_subtype_nm);
|
|
|
|
return (f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (NULL);
|
|
|
|
}
|
Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance.
o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.
Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org>
Tested by: Chekaluk Vitaly <artemrts ukr.net>
Tested by: Ben Wilber <ben desync.com>
Tested by: Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
|
|
|
#endif /* PFDEBUG */
|