diff options
Diffstat (limited to 'samples')
| -rw-r--r-- | samples/sockmap/sockmap_kern.c | 6 | ||||
| -rw-r--r-- | samples/sockmap/sockmap_user.c | 12 |
2 files changed, 12 insertions, 6 deletions
diff --git a/samples/sockmap/sockmap_kern.c b/samples/sockmap/sockmap_kern.c index 6ff986f7059b..f9b38ef82dc2 100644 --- a/samples/sockmap/sockmap_kern.c +++ b/samples/sockmap/sockmap_kern.c | |||
| @@ -82,8 +82,7 @@ int bpf_sockmap(struct bpf_sock_ops *skops) | |||
| 82 | if (lport == 10000) { | 82 | if (lport == 10000) { |
| 83 | ret = 1; | 83 | ret = 1; |
| 84 | err = bpf_sock_map_update(skops, &sock_map, &ret, | 84 | err = bpf_sock_map_update(skops, &sock_map, &ret, |
| 85 | BPF_NOEXIST, | 85 | BPF_NOEXIST); |
| 86 | BPF_SOCKMAP_STRPARSER); | ||
| 87 | bpf_printk("passive(%i -> %i) map ctx update err: %d\n", | 86 | bpf_printk("passive(%i -> %i) map ctx update err: %d\n", |
| 88 | lport, bpf_ntohl(rport), err); | 87 | lport, bpf_ntohl(rport), err); |
| 89 | } | 88 | } |
| @@ -95,8 +94,7 @@ int bpf_sockmap(struct bpf_sock_ops *skops) | |||
| 95 | if (bpf_ntohl(rport) == 10001) { | 94 | if (bpf_ntohl(rport) == 10001) { |
| 96 | ret = 10; | 95 | ret = 10; |
| 97 | err = bpf_sock_map_update(skops, &sock_map, &ret, | 96 | err = bpf_sock_map_update(skops, &sock_map, &ret, |
| 98 | BPF_NOEXIST, | 97 | BPF_NOEXIST); |
| 99 | BPF_SOCKMAP_STRPARSER); | ||
| 100 | bpf_printk("active(%i -> %i) map ctx update err: %d\n", | 98 | bpf_printk("active(%i -> %i) map ctx update err: %d\n", |
| 101 | lport, bpf_ntohl(rport), err); | 99 | lport, bpf_ntohl(rport), err); |
| 102 | } | 100 | } |
diff --git a/samples/sockmap/sockmap_user.c b/samples/sockmap/sockmap_user.c index fb78f5abefb4..7cc9d228216f 100644 --- a/samples/sockmap/sockmap_user.c +++ b/samples/sockmap/sockmap_user.c | |||
| @@ -256,8 +256,16 @@ int main(int argc, char **argv) | |||
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | /* Attach programs to sockmap */ | 258 | /* Attach programs to sockmap */ |
| 259 | err = __bpf_prog_attach(prog_fd[0], prog_fd[1], map_fd[0], | 259 | err = bpf_prog_attach(prog_fd[0], map_fd[0], |
| 260 | BPF_CGROUP_SMAP_INGRESS, 0); | 260 | BPF_SK_SKB_STREAM_PARSER, 0); |
| 261 | if (err) { | ||
| 262 | fprintf(stderr, "ERROR: bpf_prog_attach (sockmap): %d (%s)\n", | ||
| 263 | err, strerror(errno)); | ||
| 264 | return err; | ||
| 265 | } | ||
| 266 | |||
| 267 | err = bpf_prog_attach(prog_fd[1], map_fd[0], | ||
| 268 | BPF_SK_SKB_STREAM_VERDICT, 0); | ||
| 261 | if (err) { | 269 | if (err) { |
| 262 | fprintf(stderr, "ERROR: bpf_prog_attach (sockmap): %d (%s)\n", | 270 | fprintf(stderr, "ERROR: bpf_prog_attach (sockmap): %d (%s)\n", |
| 263 | err, strerror(errno)); | 271 | err, strerror(errno)); |
