FreeBSD/sys/netpfil/pf/pf_osfp.c
/* Validate that each signature is reachable */
Validate that each signature is reachable
Validate that each signature is reachable
static struct pf_os_fingerprint *
pf_osfp_validate(void)
{
	struct pf_os_fingerprint *f, *f2, find;
	SLIST_FOREACH(f, &V_pf_osfp_list, fp_next) {
		memcpy(&find, f, sizeof(find));
		if (find.fp_mss == 0)
			find.fp_mss = 128;
		if (f->fp_flags & PF_OSFP_WSIZE_MSS)
			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)
			find.fp_wsize *= 2;
		if (f != (f2 = pf_osfp_find(&V_pf_osfp_list, &find, 0))) {
			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);
}
static struct pf_os_fingerprint * pf_osfp_validate ( void ) { struct pf_os_fingerprint * f , * f2 , find ; SLIST_FOREACH ( f , & V_pf_osfp_list , fp_next ) { memcpy ( & find , f , sizeof ( find ) ) ; if ( find . fp_mss == 0 ) find . fp_mss = 128 ; if ( f -> fp_flags & PF_OSFP_WSIZE_MSS ) 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 ) find . fp_wsize *= 2 ; if ( f != ( f2 = pf_osfp_find ( & V_pf_osfp_list , & find , 0 ) ) ) { if ( f2 ) printf ( " \" \" " " \" \" \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 ( " \" \" \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 ) ; }
Validate that each signature is reachable
Validate that each signature is reachable
/* We do a few MSS/th_win percolations to make things unique */