Skip to content

Instantly share code, notes, and snippets.

@williamtu
williamtu / gist:438477daedc3823ac8882f9110fb2cc4
Last active September 6, 2023 13:35
create tun/tap device and read/write
cat tunclient.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <net/if.h>
#include <linux/if_tun.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
@williamtu
williamtu / .sh
Last active December 29, 2023 07:01
OVS AFXDP script
rm -f /usr/local/etc/openvswitch/conf.db
ovsdb-tool create /usr/local/etc/openvswitch/conf.db /root/ovs/vswitchd/vswitch.ovsschema
ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \
--remote=db:Open_vSwitch,Open_vSwitch,manager_options \
--pidfile --detach
if [ "$1" == "gdb" ]; then
gdb -ex=r --args ovs-vswitchd --no-chdir --pidfile --log-file=/root/ovs/ovs-vswitchd.log -vvconn -vofproto_dpif -vunixctl --disable-system
@williamtu
williamtu / gist:012f1ea97a3327249837ad37c8e2dc83
Last active July 1, 2024 13:17
representer without OVS offload
#!/bin/bash
PF1=eth2
VFREP1=eth4
VFREP2=eth5
VF1=eth6
VF2=eth7
NS1=ns1
NS2=ns2
NS3=ns3