aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@plumgrid.com>2014-07-24 19:38:21 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-25 02:27:17 -0400
commit2695fb552cbef1029aa025a98acb80cc51d66de5 (patch)
treec291280a14b5e77e729237fdb4d1c44544fc777c /net/core
parentdd66d386552ad3687530c1bd0e001e96a060cc0f (diff)
net: filter: rename 'struct sock_filter_int' into 'struct bpf_insn'
eBPF is used by socket filtering, seccomp and soon by tracing and exposed to userspace, therefore 'sock_filter_int' name is not accurate. Rename it to 'bpf_insn' Signed-off-by: Alexei Starovoitov <ast@plumgrid.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/filter.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/net/core/filter.c b/net/core/filter.c
index 1d0e9492e4fa..f3b2d5e9fe5f 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -174,9 +174,9 @@ static u64 __get_random_u32(u64 ctx, u64 a, u64 x, u64 r4, u64 r5)
174} 174}
175 175
176static bool convert_bpf_extensions(struct sock_filter *fp, 176static bool convert_bpf_extensions(struct sock_filter *fp,
177 struct sock_filter_int **insnp) 177 struct bpf_insn **insnp)
178{ 178{
179 struct sock_filter_int *insn = *insnp; 179 struct bpf_insn *insn = *insnp;
180 180
181 switch (fp->k) { 181 switch (fp->k) {
182 case SKF_AD_OFF + SKF_AD_PROTOCOL: 182 case SKF_AD_OFF + SKF_AD_PROTOCOL:
@@ -326,7 +326,7 @@ static bool convert_bpf_extensions(struct sock_filter *fp,
326 * 326 *
327 * 2) 2nd pass to remap in two passes: 1st pass finds new 327 * 2) 2nd pass to remap in two passes: 1st pass finds new
328 * jump offsets, 2nd pass remapping: 328 * jump offsets, 2nd pass remapping:
329 * new_prog = kmalloc(sizeof(struct sock_filter_int) * new_len); 329 * new_prog = kmalloc(sizeof(struct bpf_insn) * new_len);
330 * sk_convert_filter(old_prog, old_len, new_prog, &new_len); 330 * sk_convert_filter(old_prog, old_len, new_prog, &new_len);
331 * 331 *
332 * User BPF's register A is mapped to our BPF register 6, user BPF 332 * User BPF's register A is mapped to our BPF register 6, user BPF
@@ -336,10 +336,10 @@ static bool convert_bpf_extensions(struct sock_filter *fp,
336 * ctx == 'struct seccomp_data *'. 336 * ctx == 'struct seccomp_data *'.
337 */ 337 */
338int sk_convert_filter(struct sock_filter *prog, int len, 338int sk_convert_filter(struct sock_filter *prog, int len,
339 struct sock_filter_int *new_prog, int *new_len) 339 struct bpf_insn *new_prog, int *new_len)
340{ 340{
341 int new_flen = 0, pass = 0, target, i; 341 int new_flen = 0, pass = 0, target, i;
342 struct sock_filter_int *new_insn; 342 struct bpf_insn *new_insn;
343 struct sock_filter *fp; 343 struct sock_filter *fp;
344 int *addrs = NULL; 344 int *addrs = NULL;
345 u8 bpf_src; 345 u8 bpf_src;
@@ -365,8 +365,8 @@ do_pass:
365 new_insn++; 365 new_insn++;
366 366
367 for (i = 0; i < len; fp++, i++) { 367 for (i = 0; i < len; fp++, i++) {
368 struct sock_filter_int tmp_insns[6] = { }; 368 struct bpf_insn tmp_insns[6] = { };
369 struct sock_filter_int *insn = tmp_insns; 369 struct bpf_insn *insn = tmp_insns;
370 370
371 if (addrs) 371 if (addrs)
372 addrs[i] = new_insn - new_prog; 372 addrs[i] = new_insn - new_prog;
@@ -913,7 +913,7 @@ static struct sk_filter *__sk_migrate_filter(struct sk_filter *fp,
913 * representation. 913 * representation.
914 */ 914 */
915 BUILD_BUG_ON(sizeof(struct sock_filter) != 915 BUILD_BUG_ON(sizeof(struct sock_filter) !=
916 sizeof(struct sock_filter_int)); 916 sizeof(struct bpf_insn));
917 917
918 /* Conversion cannot happen on overlapping memory areas, 918 /* Conversion cannot happen on overlapping memory areas,
919 * so we need to keep the user BPF around until the 2nd 919 * so we need to keep the user BPF around until the 2nd
@@ -945,7 +945,7 @@ static struct sk_filter *__sk_migrate_filter(struct sk_filter *fp,
945 945
946 fp->len = new_len; 946 fp->len = new_len;
947 947
948 /* 2nd pass: remap sock_filter insns into sock_filter_int insns. */ 948 /* 2nd pass: remap sock_filter insns into bpf_insn insns. */
949 err = sk_convert_filter(old_prog, old_len, fp->insnsi, &new_len); 949 err = sk_convert_filter(old_prog, old_len, fp->insnsi, &new_len);
950 if (err) 950 if (err)
951 /* 2nd sk_convert_filter() can fail only if it fails 951 /* 2nd sk_convert_filter() can fail only if it fails