Lines Matching defs:bpf
753 int uml_vector_attach_bpf(int fd, void *bpf)
755 struct sock_fprog *prog = bpf;
757 int err = setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, bpf, sizeof(struct sock_fprog));
764 int uml_vector_detach_bpf(int fd, void *bpf)
766 struct sock_fprog *prog = bpf;
768 int err = setsockopt(fd, SOL_SOCKET, SO_DETACH_FILTER, bpf, sizeof(struct sock_fprog));
775 struct sock_filter *bpf;
787 bpf = uml_kmalloc(
789 if (bpf) {
790 bpf_prog->filter = bpf;
792 bpf[0] = (struct sock_filter){ 0x20, 0, 0, 0x00000008 };
794 bpf[1] = (struct sock_filter){ 0x15, 0, 3, ntohl(*mac1)};
796 bpf[2] = (struct sock_filter){ 0x28, 0, 0, 0x00000006 };
798 bpf[3] = (struct sock_filter){ 0x15, 0, 1, ntohs(*mac2)};
800 bpf[4] = (struct sock_filter){ 0x6, 0, 0, 0x00000000 };
802 bpf[5] = (struct sock_filter){ 0x6, 0, 0, 0x00040000 };
814 struct sock_filter *bpf;
823 printk(KERN_ERR "Error %d reading bpf file", -errno);
828 printk(KERN_ERR "Failed to allocate bpf prog buffer");
835 printk(KERN_ERR "Error %d opening bpf file", -errno);
838 bpf = uml_kmalloc(statbuf.st_size, UM_GFP_KERNEL);
839 if (bpf == NULL) {
840 printk(KERN_ERR "Failed to allocate bpf buffer");
843 bpf_prog->filter = bpf;
844 res = os_read_file(ffd, bpf, statbuf.st_size);
846 printk(KERN_ERR "Failed to read bpf program %s, error %d", filename, res);
847 kfree(bpf);