cls_bpf.c (5bbcc0f595fadb4cac0eddc4401035ec0bd95b09) | cls_bpf.c (288b3de55aace830f13280985ec9e6bcbff33b1b) |
---|---|
1/* 2 * Berkeley Packet Filter based traffic classifier 3 * 4 * Might be used to classify traffic through flexible, user-defined and 5 * possibly JIT-ed BPF filters for traffic control as an alternative to 6 * ematches. 7 * 8 * (C) 2013 Daniel Borkmann <dborkman@redhat.com> --- 368 unchanged lines hidden (view full) --- 377 return 0; 378} 379 380static int cls_bpf_prog_from_efd(struct nlattr **tb, struct cls_bpf_prog *prog, 381 u32 gen_flags, const struct tcf_proto *tp) 382{ 383 struct bpf_prog *fp; 384 char *name = NULL; | 1/* 2 * Berkeley Packet Filter based traffic classifier 3 * 4 * Might be used to classify traffic through flexible, user-defined and 5 * possibly JIT-ed BPF filters for traffic control as an alternative to 6 * ematches. 7 * 8 * (C) 2013 Daniel Borkmann <dborkman@redhat.com> --- 368 unchanged lines hidden (view full) --- 377 return 0; 378} 379 380static int cls_bpf_prog_from_efd(struct nlattr **tb, struct cls_bpf_prog *prog, 381 u32 gen_flags, const struct tcf_proto *tp) 382{ 383 struct bpf_prog *fp; 384 char *name = NULL; |
385 bool skip_sw; |
|
385 u32 bpf_fd; 386 387 bpf_fd = nla_get_u32(tb[TCA_BPF_FD]); | 386 u32 bpf_fd; 387 388 bpf_fd = nla_get_u32(tb[TCA_BPF_FD]); |
389 skip_sw = gen_flags & TCA_CLS_FLAGS_SKIP_SW; |
|
388 | 390 |
389 if (gen_flags & TCA_CLS_FLAGS_SKIP_SW) 390 fp = bpf_prog_get_type_dev(bpf_fd, BPF_PROG_TYPE_SCHED_CLS, 391 qdisc_dev(tp->q)); 392 else 393 fp = bpf_prog_get_type(bpf_fd, BPF_PROG_TYPE_SCHED_CLS); | 391 fp = bpf_prog_get_type_dev(bpf_fd, BPF_PROG_TYPE_SCHED_CLS, skip_sw); |
394 if (IS_ERR(fp)) 395 return PTR_ERR(fp); 396 397 if (tb[TCA_BPF_NAME]) { 398 name = nla_memdup(tb[TCA_BPF_NAME], GFP_KERNEL); 399 if (!name) { 400 bpf_prog_put(fp); 401 return -ENOMEM; --- 292 unchanged lines hidden --- | 392 if (IS_ERR(fp)) 393 return PTR_ERR(fp); 394 395 if (tb[TCA_BPF_NAME]) { 396 name = nla_memdup(tb[TCA_BPF_NAME], GFP_KERNEL); 397 if (!name) { 398 bpf_prog_put(fp); 399 return -ENOMEM; --- 292 unchanged lines hidden --- |