1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2016 Joyent, Inc.
  14  */
  15 
  16 #include <sys/types.h>
  17 #include <net/bpf.h>
  18 #include <inet/bpf.h>
  19 
  20 /*
  21  * With BPF filter validation and evaluation moved into the 'ip' module, these
  22  * wrapper functions are provided to expose the original interface.
  23  */
  24 
  25 uint_t
  26 bpf_filter(struct bpf_insn *pc, uchar_t *p, uint_t wirelen, uint_t buflen)
  27 {
  28         return ((uint_t)ip_bpf_filter((ip_bpf_insn_t *)pc, p, wirelen, buflen));
  29 }
  30 
  31 int
  32 bpf_validate(struct bpf_insn *f, int len)
  33 {
  34         return ((int)ip_bpf_validate((ip_bpf_insn_t *)f, (uint_t)len));
  35 }