FreeBSD/sys/netpfil/pf/pf_osfp.c
/* Fill a fingerprint by its number (from an ioctl) */
Fill a fingerprint by its number (from an ioctl)
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));
	SLIST_FOREACH(fp, &V_pf_osfp_list, fp_next) {
		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);
}
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 ) ) ; SLIST_FOREACH ( fp , & V_pf_osfp_list , fp_next ) { 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 ) ; }
Fill a fingerprint by its number (from an ioctl)
Fill a fingerprint by its number ( from an ioctl )