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
tehnerd@ubuntu18:~/katran$ bazel test katran/lib/tests/...
INFO: Analyzed 3 targets (0 packages loaded, 0 targets configured).
INFO: Found 3 test targets...
INFO: Elapsed time: 25.338s, Critical Path: 17.21s
INFO: 9 processes: 9 linux-sandbox.
INFO: Build completed successfully, 10 total actions
//katran/lib/tests:libkatran-tests (cached) PASSED in 0.6s
//katran/lib/tests:chhelpers-tests PASSED in 0.3s
//katran/lib/tests:iphelpers-tests PASSED in 0.2s
trace.py -I net/sock.h 'tcp_mtup_init(struct sock* sk) "family: %u", sk->sk_family' | head
PID TID COMM FUNC -
0 0 swapper/19 tcp_mtup_init family: 10
0 0 swapper/19 tcp_mtup_init family: 10
0 0 swapper/19 tcp_mtup_init family: 10
0 0 swapper/20 tcp_mtup_init family: 10
0 0 swapper/20 tcp_mtup_init family: 10
0 0 swapper/17 tcp_mtup_init family: 2
@tehnerd
tehnerd / siphash_collision.cu
Created August 17, 2018 04:11
siphash cuda
to run:
compile: nvcc -o ./siphash_col ./siphash_collision.cu -O3 -std=c++11
run:
time ./siphash_col
...
hash : 12260507120865799508 collided hash 15883040871881799508
mod_hash: 1799508 mod_coll_hash: 1799508
index 3799705340
hash : 12260507120865799508 collided hash 4453885830073799508
diff --git a/katran/lib/KatranLb.cpp b/katran/lib/KatranLb.cpp
index 2b7e0c6..e09e6fd 100644
--- a/katran/lib/KatranLb.cpp
+++ b/katran/lib/KatranLb.cpp
@@ -685,7 +685,9 @@ lb_stats KatranLb::getIcmpTooBigStats() {
lb_stats KatranLb::getLbStats(uint32_t position) {
unsigned int nr_cpus = sysconf(_SC_NPROCESSORS_CONF);
- lb_stats stats[nr_cpus];
+ lb_stats stats[nr_cpus<<1];
diff --git a/katran/lib/CMakeLists.txt b/katran/lib/CMakeLists.txt
index cd11504..6a86f24 100644
--- a/katran/lib/CMakeLists.txt
+++ b/katran/lib/CMakeLists.txt
@@ -9,11 +9,12 @@ set(CMAKE_CXX_COMPILER_ID "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare -Wno-bool-compare")
tehnerd@nuke:~/katran/build/katran/lib$ ./maglev_integration_test -nreals 5041 -weight 1
min freq is 13 max freq is 14
p95 w: 13
p75 w: 13
p50 w: 13
p25 w: 13
p5 w: 13
changes for affected real: 13; and for not affected 96 this is: 0.146482%
tehnerd@nuke:~/katran/build/katran/lib$ ./maglev_integration_test -nreals 5041 -weight 13
min freq is 13 max freq is 14
input:
tehnerd@nuke:~/projects/katran$ tcpdump -vnnr /tmp/kat_test
reading from file /tmp/kat_test, link-type EN10MB (Ethernet)
22:59:54.219198 IP (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto UDP (17), length 43)
192.168.1.1.31337 > 10.211.1.1.80: UDP, length 15
23:00:13.319816 IP (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto TCP (6), length 55)
192.168.1.1.31337 > 10.211.2.2.80: Flags [S], cksum 0x26e6 (correct), seq 0:15, win 8192, length 15: HTTP
23:01:06.842729 IP6 (hlim 64, next-header TCP (6) payload length: 35) fc00:2::1.31337 > fc00:2::11.80: Flags [.], cksum 0xfd3e (correct), seq 0:15, ack 0, win 8192, length 15: HTTP
23:01:37.319211 IP6 (hlim 64, next-header UDP (17) payload length: 23) fc00:2::1.31337 > fc00:2::33:11.80: [udp sum ok] UDP, length 15
tehnerd@nuke:~/projects/katran$
ps -o pid,pcpu,cputime,lwp,wchan,psr,state,comm,maj_flt,min_flt -T -p
package main
import (
"fmt"
"gnl2go/gnl2go"
)
func main() {
fmt.Println("Get pool example")
ipvs := new(gnl2go.IpvsClient)
func CustomDial(network, addr string) (net.Conn, error) {
if network != "tcp" {
fmt.Println("network is ", network)
panic("CustomDial can work only with tcp")
}
sd, err := syscall.Socket(syscall.AF_INET6, syscall.SOCK_STREAM, 0)
if err != nil {
return nil, fmt.Errorf("cant create socket: %#v\n", err)
}