Skip to content

Instantly share code, notes, and snippets.

Marek majek

Block or report user

Report or block majek

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@majek
majek / messages.txt
Last active Jul 16, 2019
out of memory in sctp
View messages.txt
a.out invoked oom-killer: gfp_mask=0x2dc0(GFP_KERNEL|__GFP_NOWARN|__GFP_ZERO), order=0, oom_score_adj=0
CPU: 0 PID: 131 Comm: a.out Not tainted 5.2.1+ #31
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
Call Trace:
dump_header.cold.35+0x11/0x985
? ___ratelimit+0x1c6/0x400
oom_kill_process+0x151/0x850
? lockdep_sys_exit+0x50/0x50
? _raw_spin_unlock+0x1f/0x30
? oom_badness.part.26+0x3e1/0x510
@majek
majek / result.txt
Created Jul 15, 2019
available setsockopts
View result.txt
[SETSOCKOPT(SOL_ICMPV6, 1)]: {.bytes = 32}
[SETSOCKOPT(SOL_IP, IP_BIND_ADDRESS_NO_PORT)]: {.min = 0, .max = 1}
[SETSOCKOPT(SOL_IP, IP_CHECKSUM)]: {.min = 0, .max = 1}
[SETSOCKOPT(SOL_IP, IP_FREEBIND)]: {.min = 0, .max = 1}
[SETSOCKOPT(SOL_IP, IP_HDRINCL)]: {.min = 0, .max = 1}
[SETSOCKOPT(SOL_IP, IP_MINTTL)]: {.min = 0, .max = 255}
[SETSOCKOPT(SOL_IP, IP_MTU_DISCOVER)]: {.min = 0, .max = 6}
[SETSOCKOPT(SOL_IP, IP_MULTICAST_ALL)]: {.min = 0, .max = 1}
// [SETSOCKOPT(SOL_IP, IP_MULTICAST_IF)]: # not settable ??
// [SETSOCKOPT(SOL_IP, IP_MULTICAST_IF)]: # only single value 0
@majek
majek / reflect_test.py
Created Jul 9, 2019
Flow label reflection doesn't work for RST
View reflect_test.py
#!/usr/bin/python3
# Before you start you need to either enable flow label reflection
# sysctl -w net.ipv6.flowlabel_reflect = 1
# or disable flow label consistency
# sysctl -w net.ipv6.flowlabel_consistency = 0
import socket
import struct
IPV6_FL_A_GET = 0
@majek
majek / double_timer_add_bug.c
Last active Jul 4, 2019
NEIGH: BUG, double timer add, state is 8
View double_timer_add_bug.c
#include <linux/netlink.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <unistd.h>
uint8_t buf1[] =
"\x28\x00\x00\x00\x1c\x00\x1b\x05\xb1\x00\x00\x80\xe2\xfc\x64\xfd\x02"
"\x00\x00\x00\x01\x00\x00\x00\x25\x84\x80\xf0\x0a\x00\x01\x00\x00\x40"
@majek
majek / .gitignore
Last active Mar 3, 2019
ebpf overlow bug
View .gitignore
ebpf-bug
venv
ebpf-bug-kern.o
ebpf-bug-ebpf.c
bpf_helpers.h
bpf.h
@majek
majek / accept2.stp
Created Jan 18, 2019
Accept latency -> time from final ACK to accept()
View accept2.stp
/*
* stap -v accept2.stp <port> <seconds>
*/
global socks[1024]
global intervals
probe kernel.function("inet_csk_reqsk_queue_add@net/ipv4/inet_connection_sock.c").call {
req = $req
socks[req] = gettimeofday_ns()
}
View .clang-format
BasedOnStyle: LLVM
IndentWidth: 8
UseTab: Always
BreakBeforeBraces: Linux
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
AlwaysBreakBeforeMultilineStrings: true
AllowShortBlocksOnASingleLine: false
ContinuationIndentWidth: 8
@majek
majek / Makefile
Created Dec 13, 2018
TCP splice with splice() experimentation
View Makefile
all:
clang -g -O2 -Wall -Wextra net.c send.c -o send
clang -g -O2 -Wall -Wextra net.c receive.c -o receive
clang -g -O2 -Wall -Wextra net.c proxy-naive.c -o proxy-naive
clang -g -O2 -Wall -Wextra net.c proxy-splice.c -o proxy-splice
@majek
majek / client.go
Created Sep 18, 2015
tcp performance
View client.go
package main
import (
"flag"
"fmt"
"net"
"os"
"strings"
"sync/atomic"
"time"
View README.md

How to run:

go build udp.go; sudo bash -c "ulimit -n 100000; ./udpserver"
go build udpclient.go && ./udpclient
sudo netstat -l4np --udp|grep :1234|tr -s " "|egrep -v "p 0"

Sample output

127.0.87.133:1234    0.347 ms
You can’t perform that action at this time.