Skip to content

Instantly share code, notes, and snippets.

View YutaroHayakawa's full-sized avatar
🌴
On vacation

Yutaro Hayakawa YutaroHayakawa

🌴
On vacation
  • Isovalent at Cisco
  • San Jose, California, US
  • 21:04 (UTC -07:00)
  • X @YutaroHayakawa
View GitHub Profile
@YutaroHayakawa
YutaroHayakawa / Makefile
Last active May 1, 2022 19:21
Demo environment for Cilium BGP Control Plane feature
deploy:
kind create cluster --config cluster.yaml
sudo containerlab -t topo.yaml deploy
helm install --kube-context kind-clab-kind-in-clab -n kube-system cilium cilium/cilium --version v1.12.0-rc1 -f values.yaml
kubectl apply -f netshoot-ds.yaml
reload:
kind delete clusters clab-kind-in-clab
sudo containerlab -t topo.yaml destroy
kind create cluster --config cluster.yaml
2012388348025305 001 dev_queue_xmit
2012388348026064 001 __dev_queue_xmit
2012388348026864 001 netdev_core_pick_tx
2012388348028138 001 validate_xmit_skb
2012388348029671 001 netif_skb_features
2012388348031002 001 skb_network_protocol
2012388348032010 001 validate_xmit_xfrm
2012388348033276 001 dev_hard_start_xmit
2012388348034273 001 ieee80211_subif_start_xmit
2012388348035331 001 __ieee80211_subif_start_xmit
50091332972064 000 ip_rcv_finish
50091332990895 000 ip_route_input_noref
50091333002316 000 ip_local_deliver
50091333010230 000 ip_local_deliver_finish
50091333013020 000 ip_protocol_deliver_rcu
50091333017298 000 raw_local_deliver
50091333020764 000 xfrm4_esp_rcv
50091333025875 000 xfrm4_rcv
50091333029768 000 xfrm_input
50091333038316 000 secpath_set
50751335472371 003 ip_rcv_finish
50751335488968 003 ip_route_input_noref
50751335500096 003 ip_local_deliver
50751335508048 003 ip_local_deliver_finish
50751335511220 003 ip_protocol_deliver_rcu
50751335515955 003 raw_local_deliver
50751335520090 003 xfrm4_esp_rcv
50751335527135 003 xfrm4_rcv
50751335531910 003 xfrm_input
50751335540593 003 secpath_set
@YutaroHayakawa
YutaroHayakawa / example.c
Last active August 3, 2020 05:37
Brief usage of the libgbpf (not tested, sorry...)
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <gbpf/gbpf.h>
struct my_data {
int mymap;
int myprog;
};
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <signal.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <getopt.h>
BPF = {}
local emit = function (code, dst, src, off, imm)
return string.pack("=I1I1I2I4", code, dst << 4 | src, off, imm)
end
-- Register
BPF.R0 = 0
BPF.R1 = 1
BPF.R2 = 2
@YutaroHayakawa
YutaroHayakawa / tun.c
Created October 28, 2019 14:29
Extension for tun device to handle IPIP GSO
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* TUN - Universal TUN/TAP device driver.
* Copyright (C) 1999-2002 Maxim Krasnyansky <[email protected]>
*
* $Id: tun.c,v 1.15 2002/03/01 02:44:24 maxk Exp $
*/
/*
* Changes:
@YutaroHayakawa
YutaroHayakawa / tap_test.c
Created October 28, 2019 13:05
Send gso frame using virtio-net header from tap
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stddef.h>
#include <net/if.h>
#include <linux/if_tun.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <assert.h>
@YutaroHayakawa
YutaroHayakawa / iptrace.py
Last active September 18, 2019 18:12
Linux kernel L3 routing tracing
import re
import click
import socket
import ipaddress
import dataclasses
from bcc import BPF
from ctypes import *
from jinja2 import Template