Lines Matching defs:bpf
754 int uml_vector_attach_bpf(int fd, void *bpf)
756 struct sock_fprog *prog = bpf;
758 int err = setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, bpf, sizeof(struct sock_fprog));
765 int uml_vector_detach_bpf(int fd, void *bpf)
767 struct sock_fprog *prog = bpf;
769 int err = setsockopt(fd, SOL_SOCKET, SO_DETACH_FILTER, bpf, sizeof(struct sock_fprog));
776 struct sock_filter *bpf;
788 bpf = uml_kmalloc(
790 if (bpf) {
791 bpf_prog->filter = bpf;
793 bpf[0] = (struct sock_filter){ 0x20, 0, 0, 0x00000008 };
795 bpf[1] = (struct sock_filter){ 0x15, 0, 3, ntohl(*mac1)};
797 bpf[2] = (struct sock_filter){ 0x28, 0, 0, 0x00000006 };
799 bpf[3] = (struct sock_filter){ 0x15, 0, 1, ntohs(*mac2)};
801 bpf[4] = (struct sock_filter){ 0x6, 0, 0, 0x00000000 };
803 bpf[5] = (struct sock_filter){ 0x6, 0, 0, 0x00040000 };
815 struct sock_filter *bpf;
824 printk(KERN_ERR "Error %d reading bpf file", -errno);
829 printk(KERN_ERR "Failed to allocate bpf prog buffer");
836 printk(KERN_ERR "Error %d opening bpf file", -errno);
839 bpf = uml_kmalloc(statbuf.st_size, UM_GFP_KERNEL);
840 if (bpf == NULL) {
841 printk(KERN_ERR "Failed to allocate bpf buffer");
844 bpf_prog->filter = bpf;
845 res = os_read_file(ffd, bpf, statbuf.st_size);
847 printk(KERN_ERR "Failed to read bpf program %s, error %d", filename, res);
848 kfree(bpf);