[PATCH RESEND] bpf: fix bad include in libbpf when srctree is set

2018-01-01 Thread Alexander Alemayhu
The relative path can be wrong and prevents the build.

Makefile:57: ../../scripts/Makefile.include: No such file or directory
make: *** No rule to make target '../../scripts/Makefile.include'.  
Stop.

Signed-off-by: Alexander Alemayhu <alexan...@alemayhu.com>
---
 tools/lib/bpf/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 4555304dc18e..0068829a56db 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -54,7 +54,7 @@ man_dir_SQ = '$(subst ','\'',$(man_dir))'
 export man_dir man_dir_SQ INSTALL
 export DESTDIR DESTDIR_SQ
 
-include ../../scripts/Makefile.include
+include $(srctree)/tools/scripts/Makefile.include
 
 # copy a bit from Linux kbuild
 
-- 
2.13.6



[PATCH iproute2 master] examples/bpf: update list of examples

2017-08-08 Thread Alexander Alemayhu
Remove deleted examples and add the new map in map example.

Signed-off-by: Alexander Alemayhu <alexan...@alemayhu.com>
---
 examples/bpf/README | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/examples/bpf/README b/examples/bpf/README
index 4247257850eb..1bbdda3f8dc1 100644
--- a/examples/bpf/README
+++ b/examples/bpf/README
@@ -1,13 +1,8 @@
 eBPF toy code examples (running in kernel) to familiarize yourself
 with syntax and features:
 
- - bpf_prog.c  -> Classifier examples with using maps
  - bpf_shared.c-> Ingress/egress map sharing example
  - bpf_tailcall.c  -> Using tail call chains
  - bpf_cyclic.c-> Simple cycle as tail calls
  - bpf_graft.c -> Demo on altering runtime behaviour
-
-User space code example:
-
- - bpf_agent.c -> Counterpart to bpf_prog.c for user
-   space to transfer/read out map data
+ - bpf_map_in_map.c -> Using map in map example
-- 
2.13.3


Re: [PATCH v2] arm: eBPF JIT compiler

2017-06-12 Thread Alexander Alemayhu
On Mon, Jun 12, 2017 at 09:10:07PM +0530, Shubham Bansal wrote:
> 
> Nope. It looks like a latest addition to testing. Can you please tell
> me how to test with it?
>
cd tools/testing/selftests/bpf/
make
sudo ./test_progs

-- 
Mit freundlichen Grüßen

Alexander Alemayhu


Re: [PATCH v1] samples/bpf: Add a .gitignore for binaries

2017-05-17 Thread Alexander Alemayhu
On Tue, May 16, 2017 at 04:27:36PM -0700, David Ahern wrote:
> 
> The problem stems from the fact that bpf samples do not really fall into
> the 'hostprogs' category (see "4 Host Program support" in
> Documentation/kbuild/makefiles.txt). Fixing samples/bpf to not rely on
> it is the better long term solution. Building of tools/ for example does
> not rely on it so there is an existing example of leveraging kernel
> headers without the overhead.
+1

I have looked into this but found it to be not easy and all attempts to
change the Makefile has resulted in obscure errors :/

Getting clang to output in a different directory was easy[0], but I guess
this is not the right approach either. Have you tried making the change?


[0]:
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 6c7468eb3684..79268d310ba5 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -1,6 +1,13 @@
 # kbuild trick to avoid linker error. Can be omitted if a module is built.
 obj- := dummy.o
 
+ifndef O
+  OUTPUT := $(shell pwd)/samples/bpf/_build/
+else
+  OUTPUT := $O/
+endif
+$(shell mkdir -p $(OUTPUT))
+
 # List of programs to build
 hostprogs-y := test_lru_dist
 hostprogs-y += sock_example
@@ -190,4 +197,4 @@ $(obj)/%.o: $(src)/%.c
-Wno-gnu-variable-sized-type-not-at-end \
-Wno-address-of-packed-member -Wno-tautological-compare \
-Wno-unknown-warning-option \
-   -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@
+   -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o 
$(OUTPUT)$(shell basename $@)

-- 
Mit freundlichen Grüßen

Alexander Alemayhu


Re: [PATCH v2 5/7] bpf: Add verifier test case for alignment.

2017-05-11 Thread Alexander Alemayhu
On Thu, May 11, 2017 at 12:06:01PM -0400, David Miller wrote:
> 
> +static int do_test_single(struct bpf_align_test *test)
> +{
> + struct bpf_insn *prog = test->insns;
> + int prog_type = test->prog_type;
> + int prog_len, i;
> + int fd_prog;
> + int ret;
> +
> + prog_len = probe_filter_length(prog);
> + fd_prog = bpf_verify_program(prog_type ? : BPF_PROG_TYPE_SOCKET_FILTER,
> +  prog, prog_len, 1, "GPL", 0,
> +  bpf_vlog, sizeof(bpf_vlog));
> + if (fd_prog < 0) {
> + printf("Failed to load program.\n");
> + printf("%s", bpf_vlog);
> + ret = 1;
> + } else {
> + ret = 0;
> + for (i = 0; i < MAX_MATCHES; i++) {
> + const char *t, *m = test->matches[i];
> +
> + if (!m)
> + break;
> + t = strstr(bpf_vlog, m);
> + if (!t) {
> + printf("Failed to find match: %s\n", m);
> + ret = 1;
> + printf("%s", bpf_vlog);
> + break;
> + }
> + }
> + /* printf("%s", bpf_vlog); */
Why is this commented out?

-- 
Mit freundlichen Grüßen

Alexander Alemayhu


[PATCH iproute2] tc: bpf: add ppc64 and sparc64 to list of archs with eBPF support

2017-05-06 Thread Alexander Alemayhu
sparc64 support was added in 7a12b5031c6b (sparc64: Add eBPF JIT., 
2017-04-17)[0]
and ppc64 in 156d0e290e96 (powerpc/ebpf/jit: Implement JIT compiler for 
extended BPF, 2016-06-22)[1].

[0]: 
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=7a12b5031c6b
[1]: 
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=156d0e290e96
Signed-off-by: Alexander Alemayhu <alexan...@alemayhu.com>
---
 man/man8/tc-bpf.8 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/man/man8/tc-bpf.8 b/man/man8/tc-bpf.8
index e371964d06ab..2e9812ede028 100644
--- a/man/man8/tc-bpf.8
+++ b/man/man8/tc-bpf.8
@@ -75,9 +75,9 @@ In Linux, it's generally considered that eBPF is the 
successor of cBPF.
 The kernel internally transforms cBPF expressions into eBPF expressions and
 executes the latter. Execution of them can be performed in an interpreter
 or at setup time, they can be just-in-time compiled (JIT'ed) to run as
-native machine code. Currently, x86_64, ARM64 and s390 architectures have
-eBPF JIT support, whereas PPC, SPARC, ARM and MIPS have cBPF, but did not
-(yet) switch to eBPF JIT support.
+native machine code. Currently, x86_64, ARM64, s390, ppc64 and sparc64
+architectures have eBPF JIT support, whereas PPC, SPARC, ARM and MIPS have
+cBPF, but did not (yet) switch to eBPF JIT support.
 
 eBPF's instruction set has similar underlying principles as the cBPF
 instruction set, it however is modelled closer to the underlying
-- 
2.7.4



Re: [RFC net-next 2/2] bpf: Test for bpf_prog ID and BPF_PROG_GET_NEXT_ID

2017-04-27 Thread Alexander Alemayhu
On Wed, Apr 26, 2017 at 11:24:49PM -0700, Martin KaFai Lau wrote:
> Add test to exercise the bpf_prog id generation
> and iteration.
> 
Could test_prog_id be a function in tools/testing/selftests/bpf/test_progs.c
instead? bpf_prog_load is already available there.

-- 
Mit freundlichen Grüßen

Alexander Alemayhu


Re: [PATCH net-next 3/3] samples/bpf: check before defining offsetof

2017-04-25 Thread Alexander Alemayhu
On Tue, Apr 25, 2017 at 02:27:16PM +, David Laight wrote:
> 
> Isn't the correct fix to include stddef.h ?
>
If you think it's the correct fix, please send a patch to netdev.

Thanks.

-- 
Mit freundlichen Grüßen

Alexander Alemayhu


[PATCH net-next 1/3] samples/bpf: add -Wno-unknown-warning-option to clang

2017-04-24 Thread Alexander Alemayhu
I was initially going to remove '-Wno-address-of-packed-member' because I
thought it was not supposed to be there but Daniel suggested using
'-Wno-unknown-warning-option'. 

This silences several warnings similiar to the one below

warning: unknown warning option '-Wno-address-of-packed-member' 
[-Wunknown-warning-option]
1 warning generated.
clang  -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/6.3.1/include 
-I./arch/x86/include -I./arch/x86/include/generated/uapi 
-I./arch/x86/include/generated  -I./include
 -I./arch/x86/include/uapi -I./include/uapi -I./include/generated/uapi -include 
./include/linux/kconfig.h  \
-D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \
-Wno-compare-distinct-pointer-types \
-Wno-gnu-variable-sized-type-not-at-end \
-Wno-address-of-packed-member -Wno-tautological-compare \
-O2 -emit-llvm -c samples/bpf/xdp_tx_iptunnel_kern.c -o -| llc 
-march=bpf -filetype=obj -o samples/bpf/xdp_tx_iptunnel_kern.o

$ clang --version

 clang version 3.9.1 (tags/RELEASE_391/final)
 Target: x86_64-unknown-linux-gnu
 Thread model: posix
 InstalledDir: /usr/bin

Signed-off-by: Alexander Alemayhu <alexan...@alemayhu.com>
---
 samples/bpf/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index d42b495b0992..6c7468eb3684 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -189,4 +189,5 @@ $(obj)/%.o: $(src)/%.c
-Wno-compare-distinct-pointer-types \
-Wno-gnu-variable-sized-type-not-at-end \
-Wno-address-of-packed-member -Wno-tautological-compare \
+   -Wno-unknown-warning-option \
-O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@
-- 
2.9.3



[PATCH net-next 2/3] samples/bpf: add static to function with no prototype

2017-04-24 Thread Alexander Alemayhu
Fixes the following warning

samples/bpf/cookie_uid_helper_example.c: At top level:
samples/bpf/cookie_uid_helper_example.c:276:6: warning: no previous prototype 
for ‘finish’ [-Wmissing-prototypes]
 void finish(int ret)
  ^~
  HOSTLD  samples/bpf/per_socket_stats_example

Signed-off-by: Alexander Alemayhu <alexan...@alemayhu.com>
---
 samples/bpf/cookie_uid_helper_example.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/bpf/cookie_uid_helper_example.c 
b/samples/bpf/cookie_uid_helper_example.c
index ad5afedf2e70..9ce55840d61d 100644
--- a/samples/bpf/cookie_uid_helper_example.c
+++ b/samples/bpf/cookie_uid_helper_example.c
@@ -273,7 +273,7 @@ static int usage(void)
return 1;
 }
 
-void finish(int ret)
+static void finish(int ret)
 {
test_finish = true;
 }
-- 
2.9.3



[PATCH net-next 3/3] samples/bpf: check before defining offsetof

2017-04-24 Thread Alexander Alemayhu
Fixes the following warning

samples/bpf/test_lru_dist.c:28:0: warning: "offsetof" redefined
 #define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER)

In file included from ./tools/lib/bpf/bpf.h:25:0,
 from samples/bpf/libbpf.h:5,
 from samples/bpf/test_lru_dist.c:24:
/usr/lib/gcc/x86_64-redhat-linux/6.3.1/include/stddef.h:417:0: note: this is 
the location of the previous definition
 #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)

Signed-off-by: Alexander Alemayhu <alexan...@alemayhu.com>
---
 samples/bpf/test_lru_dist.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/samples/bpf/test_lru_dist.c b/samples/bpf/test_lru_dist.c
index d96dc88d3b04..73c357142268 100644
--- a/samples/bpf/test_lru_dist.c
+++ b/samples/bpf/test_lru_dist.c
@@ -25,7 +25,9 @@
 #include "bpf_util.h"
 
 #define min(a, b) ((a) < (b) ? (a) : (b))
-#define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER)
+#ifndef offsetof
+# define offsetof(TYPE, MEMBER)((size_t)&((TYPE *)0)->MEMBER)
+#endif
 #define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr);\
(type *)( (char *)__mptr - offsetof(type,member) );})
-- 
2.9.3



[PATCH net-next 0/3] Misc BPF cleanup

2017-04-24 Thread Alexander Alemayhu
Hei,

while looking into making the Makefile in samples/bpf better handle O= I saw
several warnings when running `make clean && make samples/bpf/`. This series
reduces those warnings.

Thanks.

Alexander Alemayhu (3):
  samples/bpf: add -Wno-unknown-warning-option to clang
  samples/bpf: add static to function with no prototype
  samples/bpf: check before defining offsetof

 samples/bpf/Makefile| 1 +
 samples/bpf/cookie_uid_helper_example.c | 2 +-
 samples/bpf/test_lru_dist.c | 4 +++-
 3 files changed, 5 insertions(+), 2 deletions(-)

-- 
2.9.3



Re: [PATCH net-next] bpf: add test_progs to .gitignore

2017-04-11 Thread Alexander Alemayhu
On Tue, Apr 11, 2017 at 08:08:24AM -0600, David Ahern wrote:
> 
> listing each program is not a sustainable way to do this. It would be
> simpler to put build targets into a build directory and then ignore the
> build directory.

Agreed. It has probably been raised before, but if no one else does I can send
something later (still learning the make syntax).

Thanks.

-- 
Mit freundlichen Grüßen

Alexander Alemayhu


Re: [PATCH net-next] bpf: add test_progs to .gitignore

2017-04-11 Thread Alexander Alemayhu
On Tue, Apr 11, 2017 at 01:49:10PM +0200, Daniel Borkmann wrote:
> 
> Good point, we should also add '*.o' in that case for the
> TEST_GEN_FILES specified objs that clang generates.

Think that is covered by other files but added. Would it be
okay to ignore all the generated files, like the below?

commit 1036c0af4dc381c2571947f197c9d30c2c9f4510
Author: Alexander Alemayhu <alexan...@alemayhu.com>
Date:   Tue Apr 11 13:31:32 2017 +0200

bpf: ignore generated files

o add test_progs to tools/testing/selftests/bpf/.gitignore and the other
generated files.
o new ignore file in samples/bpf

Signed-off-by: Alexander Alemayhu <alexan...@alemayhu.com>

diff --git a/samples/bpf/.gitignore b/samples/bpf/.gitignore
new file mode 100644
index ..6537659507f1
--- /dev/null
+++ b/samples/bpf/.gitignore
@@ -0,0 +1,35 @@
+fds_example
+lathist
+lwt_len_hist
+map_perf_test
+offwaketime
+per_socket_stats_example
+sampleip
+sock_example
+sockex1
+sockex2
+sockex3
+spintest
+tc_l2_redirect
+test_cgrp2_array_pin
+test_cgrp2_attach
+test_cgrp2_attach2
+test_cgrp2_sock
+test_cgrp2_sock2
+test_current_task_under_cgroup
+test_lru_dist
+test_map_in_map
+test_overhead
+test_probe_write_user
+trace_event
+trace_output
+tracex1
+tracex2
+tracex3
+tracex4
+tracex5
+tracex6
+xdp1
+xdp2
+xdp_tx_iptunnel
+*.o
diff --git a/tools/testing/selftests/bpf/.gitignore 
b/tools/testing/selftests/bpf/.gitignore
index 541d9d7fad5a..78c8fb7077e0 100644
--- a/tools/testing/selftests/bpf/.gitignore
+++ b/tools/testing/selftests/bpf/.gitignore
@@ -3,3 +3,8 @@ test_maps
 test_lru_map
 test_lpm_map
 test_tag
+test_progs
+FEATURE-DUMP.libbpf
+feature/
+fixdep
+*.o

Thanks.

-- 
Mit freundlichen Grüßen

Alexander Alemayhu


[PATCH net-next] bpf: add test_progs to .gitignore

2017-04-11 Thread Alexander Alemayhu
Signed-off-by: Alexander Alemayhu <alexan...@alemayhu.com>
---
 tools/testing/selftests/bpf/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/bpf/.gitignore 
b/tools/testing/selftests/bpf/.gitignore
index 541d9d7fad5a..2fe8766e204f 100644
--- a/tools/testing/selftests/bpf/.gitignore
+++ b/tools/testing/selftests/bpf/.gitignore
@@ -3,3 +3,4 @@ test_maps
 test_lru_map
 test_lpm_map
 test_tag
+test_progs
-- 
2.9.3



[PATCH net-next] bpf: fix comment typo

2017-04-08 Thread Alexander Alemayhu
o s/bpf_bpf_get_socket_cookie/bpf_get_socket_cookie

Signed-off-by: Alexander Alemayhu <alexan...@alemayhu.com>
---
 include/uapi/linux/bpf.h   | 2 +-
 tools/include/uapi/linux/bpf.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index a1d95386f562..1e062bb54eec 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -472,7 +472,7 @@ union bpf_attr {
  *   > 0 length of the string including the trailing NUL on success
  *   < 0 error
  *
- * u64 bpf_bpf_get_socket_cookie(skb)
+ * u64 bpf_get_socket_cookie(skb)
  * Get the cookie for the socket stored inside sk_buff.
  * @skb: pointer to skb
  * Return: 8 Bytes non-decreasing number on success or 0 if the socket
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index a1d95386f562..1e062bb54eec 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -472,7 +472,7 @@ union bpf_attr {
  *   > 0 length of the string including the trailing NUL on success
  *   < 0 error
  *
- * u64 bpf_bpf_get_socket_cookie(skb)
+ * u64 bpf_get_socket_cookie(skb)
  * Get the cookie for the socket stored inside sk_buff.
  * @skb: pointer to skb
  * Return: 8 Bytes non-decreasing number on success or 0 if the socket
-- 
2.7.4



Re: [PATCH iproute2] man: fix man page warnings

2017-04-05 Thread Alexander Alemayhu
On Wed, Apr 05, 2017 at 04:56:23PM +0200, Phil Sutter wrote:
> 
> People using '.R' try to force "normal" font, like for every second
> parameter to '.IR' but in fact they could just leave the macro away
> since lines starting without any macro will get normal font settings
> anyway.
>
I will keep your comment in mind for next time.

Thanks.

-- 
Mit freundlichen Grüßen

Alexander Alemayhu


[PATCH iproute2] man: fix man page warnings

2017-03-26 Thread Alexander Alemayhu
While generating PDFs from the man pages, I saw the warning below from
several files. Compared the tc-matchall.8 with bridge.8 and used .RI
instead of .R. It should have no effect on the man page rendering.

`R' is a string (producing the registered sign), not a macro.

Signed-off-by: Alexander Alemayhu <alexan...@alemayhu.com>
---
 man/man8/tc-flower.8   | 2 +-
 man/man8/tc-ife.8  | 2 +-
 man/man8/tc-matchall.8 | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8
index fc5bac503324..ba290657c224 100644
--- a/man/man8/tc-flower.8
+++ b/man/man8/tc-flower.8
@@ -20,7 +20,7 @@ flower \- flow based traffic control filter
 .B indev
 .IR ifname " | "
 .BR skip_sw " | " skip_hw
-.R " | { "
+.RI " | { "
 .BR dst_mac " | " src_mac " } "
 .IR MASKED_LLADDR " | "
 .B vlan_id
diff --git a/man/man8/tc-ife.8 b/man/man8/tc-ife.8
index dae8b9be9bcb..a8f1f287d150 100644
--- a/man/man8/tc-ife.8
+++ b/man/man8/tc-ife.8
@@ -13,7 +13,7 @@ IFE - encapsulate/decapsulate metadata
 .IR SMAC " ] "
 .RB "[ " type
 .IR TYPE " ] "
-.R "[ "
+.RI "[ "
 .IR CONTROL " ] "
 .RB "[ " index
 .IR INDEX " ] "
diff --git a/man/man8/tc-matchall.8 b/man/man8/tc-matchall.8
index 53b2194e023a..e3cddb1f1ca5 100644
--- a/man/man8/tc-matchall.8
+++ b/man/man8/tc-matchall.8
@@ -7,7 +7,7 @@ matchall \- traffic control filter that matches every packet
 .ti -8
 .BR tc " " filter " ... " matchall " [ "
 .BR skip_sw " | " skip_hw
-.R " ] [ "
+.RI " ] [ "
 .B action
 .IR ACTION_SPEC " ] [ "
 .B classid
-- 
2.9.3



Re: [PATCH net-next 1/2] tcp: remove per-destination timestamp cache

2017-03-19 Thread Alexander Alemayhu
On Wed, Mar 15, 2017 at 05:06:58PM -0700, Eric Dumazet wrote:
> 
> Nat are good, Nat are good.
> 
> I can't find this hilarious video we watched in Copenhagen ;)
> 
Maybe 'Oops, I did it: IPv6 NAT by Patrick McHardy'[0]. Starts around
19:10.

[0]: http://video.dkuug.dk/media/oops-i-did-it-ipv6-nat-by-patrick-mchardy

-- 
Mit freundlichen Grüßen

Alexander Alemayhu


[PATCH iproute2] man: add examples to ip.8

2017-03-12 Thread Alexander Alemayhu
Having some examples in the top level man page might make it a little bit easier
for new users to get started. Reused some words / sentences from the existing
man pages.

Suggested-by: 積丹尼 Dan Jacobson <jida...@jidanni.org>
Signed-off-by: Alexander Alemayhu <alexan...@alemayhu.com>
---
This is my first man page patch, hopefully I've done everything correctly.
If not please let me know, thanks.

 man/man8/ip.8 | 28 
 1 file changed, 28 insertions(+)

diff --git a/man/man8/ip.8 b/man/man8/ip.8
index 8ecb1996da92..1c5a7419e4fc 100644
--- a/man/man8/ip.8
+++ b/man/man8/ip.8
@@ -319,6 +319,34 @@ or, if the objects of this class cannot be listed,
 Exit status is 0 if command was successful, and 1 if there is a syntax error.
 If an error was reported by the kernel exit status is 2.
 
+.SH "EXAMPLES"
+.PP
+ip addr
+.RS 4
+Shows addresses assigned to all network interfaces.
+.RE
+.PP
+ip neigh
+.RS 4
+Shows the current neighbour table in kernel.
+.RE
+.PP
+ip link set x up
+.RS 4
+Bring up interface x.
+.RE
+.PP
+ip link set x down
+.RE
+.RS 4
+Bring down interface x.
+.RE
+.PP
+ip route
+.RS 4
+Show table routes.
+.RE
+
 .SH HISTORY
 .B ip
 was written by Alexey N. Kuznetsov and added in Linux 2.2.
-- 
2.9.3



Re: please add some examples to the ip man page

2017-03-09 Thread Alexander Alemayhu
On Wed, Mar 08, 2017 at 03:17:02PM +0800, 積丹尼 Dan Jacobson wrote:
> I see.
> Perhaps on the man page add
> EXAMPLES
>See https://www.kernel.org/doc/Documentation/networking/vrf.txt
>https://www.google.com/search?q=ip+linux+command+usage+examples
> (I thought the latter would be hopeless, but actually found lots!)
> 
Actual examples in the page would better than links IMO.  git has some
nice examples in gittutorial(7) and giteveryday(7). Maybe that can be
good inspiration?

-- 
Mit freundlichen Grüßen

Alexander Alemayhu


[PATCH] bpf: reduce compiler warnings by adding fallthrough comments

2017-02-13 Thread Alexander Alemayhu
Fixes the following warnings:

kernel/bpf/verifier.c: In function ‘may_access_direct_pkt_data’:
kernel/bpf/verifier.c:702:6: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
   if (t == BPF_WRITE)
  ^
kernel/bpf/verifier.c:704:2: note: here
  case BPF_PROG_TYPE_SCHED_CLS:
  ^~~~
kernel/bpf/verifier.c: In function ‘reg_set_min_max_inv’:
kernel/bpf/verifier.c:2057:23: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
   true_reg->min_value = 0;
   ^~~
kernel/bpf/verifier.c:2058:2: note: here
  case BPF_JSGT:
  ^~~~
kernel/bpf/verifier.c:2068:23: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
   true_reg->min_value = 0;
   ^~~
kernel/bpf/verifier.c:2069:2: note: here
  case BPF_JSGE:
  ^~~~
kernel/bpf/verifier.c: In function ‘reg_set_min_max’:
kernel/bpf/verifier.c:2009:24: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
   false_reg->min_value = 0;
   ~^~~
kernel/bpf/verifier.c:2010:2: note: here
  case BPF_JSGT:
  ^~~~
kernel/bpf/verifier.c:2019:24: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
   false_reg->min_value = 0;
   ~^~~
kernel/bpf/verifier.c:2020:2: note: here
  case BPF_JSGE:
  ^~~~

Reported-by: David Binderman <dcb...@hotmail.com>
Signed-off-by: Alexander Alemayhu <alexan...@alemayhu.com>
---
Using gcc (GCC) 7.0.1 20170204 (Red Hat 7.0.1-0.6)

 kernel/bpf/verifier.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 1a754e5d2695..d2bded2b250c 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -701,6 +701,7 @@ static bool may_access_direct_pkt_data(struct 
bpf_verifier_env *env,
/* dst_input() and dst_output() can't write for now */
if (t == BPF_WRITE)
return false;
+   /* fallthrough */
case BPF_PROG_TYPE_SCHED_CLS:
case BPF_PROG_TYPE_SCHED_ACT:
case BPF_PROG_TYPE_XDP:
@@ -2007,6 +2008,7 @@ static void reg_set_min_max(struct bpf_reg_state 
*true_reg,
case BPF_JGT:
/* Unsigned comparison, the minimum value is 0. */
false_reg->min_value = 0;
+   /* fallthrough */
case BPF_JSGT:
/* If this is false then we know the maximum val is val,
 * otherwise we know the min val is val+1.
@@ -2017,6 +2019,7 @@ static void reg_set_min_max(struct bpf_reg_state 
*true_reg,
case BPF_JGE:
/* Unsigned comparison, the minimum value is 0. */
false_reg->min_value = 0;
+   /* fallthrough */
case BPF_JSGE:
/* If this is false then we know the maximum value is val - 1,
 * otherwise we know the mimimum value is val.
@@ -2055,6 +2058,7 @@ static void reg_set_min_max_inv(struct bpf_reg_state 
*true_reg,
case BPF_JGT:
/* Unsigned comparison, the minimum value is 0. */
true_reg->min_value = 0;
+   /* fallthrough */
case BPF_JSGT:
/*
 * If this is false, then the val is <= the register, if it is
@@ -2066,6 +2070,7 @@ static void reg_set_min_max_inv(struct bpf_reg_state 
*true_reg,
case BPF_JGE:
/* Unsigned comparison, the minimum value is 0. */
true_reg->min_value = 0;
+   /* fallthrough */
case BPF_JSGE:
/* If this is false then constant < register, if it is true then
 * the register < constant.
-- 
2.11.1



Re: [PATCH net-next] IPsec: do not ignore crypto err in ah input

2017-01-12 Thread Alexander Alemayhu
On Thu, Jan 12, 2017 at 03:33:22PM +0200, Gilad Ben-Yossef wrote:
> ah input processing uses the asynchrnous hash crypto API which
> supplies an error code as part of the operation completion but 
> the error code was being ignored.
>
s/asynchrnous/asynchronous

-- 
Mit freundlichen Grüßen

Alexander Alemayhu


[PATCH net] ipv6: fix typos

2017-01-07 Thread Alexander Alemayhu
o s/approriate/appropriate
o s/discouvery/discovery

Signed-off-by: Alexander Alemayhu <alexan...@alemayhu.com>
---
 net/ipv6/route.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 8417c41d8ec8..ce5aaf448c54 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1464,7 +1464,7 @@ static struct rt6_info *__ip6_route_redirect(struct net 
*net,
struct fib6_node *fn;
 
/* Get the "current" route for this destination and
-* check if the redirect has come from approriate router.
+* check if the redirect has come from appropriate router.
 *
 * RFC 4861 specifies that redirects should only be
 * accepted if they come from the nexthop to the target.
@@ -2768,7 +2768,7 @@ static int rt6_mtu_change_route(struct rt6_info *rt, void 
*p_arg)
   old MTU is the lowest MTU in the path, update the route PMTU
   to reflect the increase. In this case if the other nodes' MTU
   also have the lowest MTU, TOO BIG MESSAGE will be lead to
-  PMTU discouvery.
+  PMTU discovery.
 */
if (rt->dst.dev == arg->dev &&
dst_metric_raw(>dst, RTAX_MTU) &&
-- 
2.11.0



[PATCH ipsec] xfrm: trivial typos

2017-01-03 Thread Alexander Alemayhu
o s/descentant/descendant
o s/workarbound/workaround

Signed-off-by: Alexander Alemayhu <alexan...@alemayhu.com>
---
 net/xfrm/xfrm_policy.c | 2 +-
 net/xfrm/xfrm_state.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 177e208e8ff5..99ad1af2927f 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -330,7 +330,7 @@ void xfrm_policy_destroy(struct xfrm_policy *policy)
 }
 EXPORT_SYMBOL(xfrm_policy_destroy);
 
-/* Rule must be locked. Release descentant resources, announce
+/* Rule must be locked. Release descendant resources, announce
  * entry dead. The rule must be unlinked from lists to the moment.
  */
 
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 64e3c82eedf6..c5cf4d611aab 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -409,7 +409,7 @@ static enum hrtimer_restart xfrm_timer_handler(struct 
hrtimer *me)
if (x->xflags & XFRM_SOFT_EXPIRE) {
/* enter hard expire without soft expire first?!
 * setting a new date could trigger this.
-* workarbound: fix x->curflt.add_time by below:
+* workaround: fix x->curflt.add_time by below:
 */
x->curlft.add_time = now - x->saved_tmo - 1;
tmo = x->lft.hard_add_expires_seconds - 
x->saved_tmo;
-- 
2.11.0



[PATCH net] Documentation/networking: fix typo in mpls-sysctl

2017-01-02 Thread Alexander Alemayhu
s/utliziation/utilization

Signed-off-by: Alexander Alemayhu <alexan...@alemayhu.com>
---
 Documentation/networking/mpls-sysctl.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/networking/mpls-sysctl.txt 
b/Documentation/networking/mpls-sysctl.txt
index 9ed15f86c17c..15d8d16934fd 100644
--- a/Documentation/networking/mpls-sysctl.txt
+++ b/Documentation/networking/mpls-sysctl.txt
@@ -5,8 +5,8 @@ platform_labels - INTEGER
possible to configure forwarding for label values equal to or
greater than the number of platform labels.
 
-   A dense utliziation of the entries in the platform label table
-   is possible and expected aas the platform labels are locally
+   A dense utilization of the entries in the platform label table
+   is possible and expected as the platform labels are locally
allocated.
 
If the number of platform label table entries is set to 0 no
-- 
2.11.0



Re: [ANNOUNCE] bridge-utils 1.6 release

2016-10-17 Thread Alexander Alemayhu
On Mon, Oct 17, 2016 at 09:03:30AM -0700, Stephen Hemminger wrote:
> 
> Source:
>   
> http://www.kernel.org/pub/linux/utils/net/bridge-utils/bridge-utils.1.6.tar.gz
>

This link seems to be broken.

-- 
Mit freundlichen Grüßen

Alexander Alemayhu


Re: Hello

2016-10-17 Thread Alexander Alemayhu
On Fri, Oct 14, 2016 at 05:17:36PM +0800, yuehaibing wrote:
> subscribe linux-kernel
> 

Try sending subscribe linux-kernel to majord...@vger.kernel.org


Re: hello

2016-10-17 Thread Alexander Alemayhu
On Fri, Oct 14, 2016 at 05:18:10PM +0800, maowenan wrote:
> i want to subscribe this mail, thank you very much.
> 

Try sending subscribe netdev to majord...@vger.kernel.org


[PATCH net-next] Documentation/networking: update git urls to use https over http

2016-10-13 Thread Alexander Alemayhu
This fixes the following errors when trying to clone the urls:

Cloning into 'net'...
fatal: repository 'http://git.kernel.org/cgit/linux/kernel/git/davem/net.git/' 
not found
Cloning into 'net-next'...
fatal: repository 
'http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/' not found
Cloning into 'linux'...
fatal: repository 
'http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/' not found
Cloning into 'stable-queue'...
fatal: repository 
'http://git.kernel.org/cgit/linux/kernel/git/stable/stable-queue.git/' not found

Signed-off-by: Alexander Alemayhu <alexan...@alemayhu.com>
---
 Documentation/networking/netdev-FAQ.txt | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/networking/netdev-FAQ.txt 
b/Documentation/networking/netdev-FAQ.txt
index 0fe1c6e0dbcd..a20b2fae942b 100644
--- a/Documentation/networking/netdev-FAQ.txt
+++ b/Documentation/networking/netdev-FAQ.txt
@@ -29,8 +29,8 @@ A: There are always two trees (git repositories) in play.  
Both are driven
Linus, and net-next is where the new code goes for the future release.
You can find the trees here:
 
-   http://git.kernel.org/?p=linux/kernel/git/davem/net.git
-   http://git.kernel.org/?p=linux/kernel/git/davem/net-next.git
+https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
+https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
 
 Q: How often do changes from these trees make it to the mainline Linus tree?
 
@@ -76,7 +76,7 @@ Q: So where are we now in this cycle?
 
 A: Load the mainline (Linus) page here:
 
-   http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git
+   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
 
and note the top of the "tags" section.  If it is rc1, it is early
in the dev cycle.  If it was tagged rc7 a week ago, then a release
@@ -123,7 +123,7 @@ A: Normally Greg Kroah-Hartman collects stable commits 
himself, but
 
It contains the patches which Dave has selected, but not yet handed
off to Greg.  If Greg already has the patch, then it will be here:
-   http://git.kernel.org/cgit/linux/kernel/git/stable/stable-queue.git
+   https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git
 
A quick way to find whether the patch is in this stable-queue is
to simply clone the repo, and then git grep the mainline commit ID, e.g.
-- 
2.10.1