Skip to content

Instantly share code, notes, and snippets.

View tehnerd's full-sized avatar

Nikita V. Shirokov tehnerd

  • Dropbox
  • behind the terminal
View GitHub Profile
#include <net/tcp.h>
k:tcp_mtup_init {
$tp = (struct tcp_sock*)arg0;
@mss_hist = lhist($tp->rx_opt.mss_clamp, 1200, 1500, 10);
}
interval:s:60 {
print(@mss_hist);
clear(@mss_hist);
diff --git a/example_grpc/CMakeLists.txt b/example_grpc/CMakeLists.txt
index 7fc13f4..ec0aa70 100644
--- a/example_grpc/CMakeLists.txt
+++ b/example_grpc/CMakeLists.txt
@@ -6,6 +6,7 @@ find_library(PROTOBUF libprotobuf.a protobuf)
set(GRPC_BUILD_PATH "${CMAKE_PREFIX_PATH}/grpc/build")
set(GRPC_LIBRARIES_PATH "${GRPC_BUILD_PATH}")
set(CARES_LIBRARIES_PATH "${GRPC_LIBRARIES_PATH}/third_party/cares/cares/lib")
+set(ABSL_LIBRARIES_PATH "${GRPC_LIBRARIES_PATH}/third_party/abseil-cpp/absl")
find_library(ADDR_SORT libaddress_sorting.a address_sorting PATHS ${GRPC_LIBRARIES_PATH} NO_DEFAULT_PATH)
/home/tehnerd/linux-bpfnext/tools/testing/selftests/bpf/tools/usr/local/sbin/bpftool gen skeleton /home/tehnerd/linux-bpfnext/tools/testing/selftests/bpf/connect4_prog.o > /home/tehnerd/linux-bpfnext/tools/testing/selftests/bpf/connect4_prog.skel.h
*** invalid %N$ use detected ***
/home/tehnerd/linux-bpfnext/tools/testing/selftests/bpf/tools/usr/local/sbin/bpftool gen skeleton /home/tehnerd/linux-bpfnext/tools/testing/selftests/bpf/fexit_bpf2bpf.o > /home/tehnerd/linux-bpfnext/tools/testing/selftests/bpf/fexit_bpf2bpf.skel.h
*** invalid %N$ use detected ***
/home/tehnerd/linux-bpfnext/tools/testing/selftests/bpf/tools/usr/local/sbin/bpftool gen skeleton /home/tehnerd/linux-bpfnext/tools/testing/selftests/bpf/test_global_data.o > /home/tehnerd/linux-bpfnext/tools/testing/selftests/bpf/test_global_data.skel.h
*** invalid %N$ use detected ***
diff --git a/katran/lib/bpf/balancer_kern.c b/katran/lib/bpf/balancer_kern.c
index 93dca2e..99e7d45 100644
--- a/katran/lib/bpf/balancer_kern.c
+++ b/katran/lib/bpf/balancer_kern.c
@@ -240,7 +240,7 @@ static inline int process_l3_headers(struct packet_description *pckt,
__attribute__((__always_inline__))
static inline int process_encaped_pckt(void **data, void **data_end,
struct xdp_md *xdp, bool *is_ipv6,
- __u8 *protocol) {
+ __u8 *protocol, bool pass) {
ngth 15: HTTP
20:09:34.732229 IP6 (hlim 64, next-header IPIP (4) payload length: 43) 100::64 > fc00:1404::1: IP (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto UDP (17), length 43)
192.168.1.3.31337 > 10.200.1.1.80: [udp sum ok] UDP, length 15
20:09:34.732233 IP6 (hlim 64, next-header IPIP (4) payload length: 43) 100::bac1:103 > fc00::2307:1: IP (tos 0x0, ttl 63, id 1, offset 0, flags [none], proto UDP (17), length 43)
192.168.1.3.31337 > 10.200.1.1.80: [udp sum ok] UDP, length 15
20:09:34.732241 IP6 (hlim 64, next-header IPv6 (41) payload length: 75) 100::64 > fc00:1404::1: IP6 (hlim 64, next-header TCP (6) payload length: 35) fc00:2307:1::2.31337 > fc00:1::1.80: Flags [.], cksum 0xda48 (correct), seq 0:15, ack 0, win 8192, length 15: HTTP
20:09:34.732245 IP6 (hlim 64, next-header IPv6 (41) payload length: 75) 100::7a69:2 > fc00::2307:3: IP6 (hlim 63, next-header TCP (6) payload length: 35) fc00:2307:1::2.31337 > fc00:1::1.80: Flags [.], cksum 0xda48 (correct), seq 0:15, ack 1, win 8192, length
gue encap in wireshark
In file included from bpf/balancer_kern.c:20:
bpf/handle_icmp.h:121:9: warning: incompatible integer to pointer conversion initializing 'void *' with an expression of type '__u32' (aka 'unsigned int') [-Wint-conversion]
void *data = xdp->data;
^ ~~~~~~~~~ bpf/handle_icmp.h:122:9: warning: incompatible integer to pointer conversion initializing 'void *' with an expression of type '__u32' (aka 'unsigned int') [-Wint-conversion]
void *data_end = xdp->data_end;
^ ~~~~~~~~~~~~~
bpf/handle_icmp.h:166:9: warning: incompatible integer to pointer conversion initializing 'void *' with an expression of type '__u32' (aka 'unsigned int') [-Wint-conversion]
void *data = xdp->data;
^ ~~~~~~~~~
bpf/handle_icmp.h:167:9: warning: incompatible integer to pointer conversion initializing 'void *' with an expression of type '__u32' (aka
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
clang-format from clang-8.0.0 w/ default params
tehnerd@devubuntu:~/katran/katran/lib$ ../../deps/clang/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang-format -i KatranLb.cpp
on top of
Author: udippant <[email protected]>
Date: Fri Aug 9 15:15:47 2019 -0700
@tehnerd
tehnerd / cgo.md
Created July 7, 2019 04:22 — forked from zchee/cgo.md
cgo convert list

See also, http://libraryofalexandria.io/cgo/

Using Go cgo

cgo has a lot of trap.
but Not "C" pkg also directory in $GOROOT/src. IDE's(vim) Goto command not works.

So, Here collect materials.