Skip to content

Instantly share code, notes, and snippets.

View joestringer's full-sized avatar

Joe Stringer joestringer

View GitHub Profile
@joestringer
joestringer / ct-zone-flows
Last active September 22, 2015 22:06
Autotest flows for basic multi-stage pipeline using conntrack zones
dnl Allow traffic from local stack to ns0. Only allow neighbour discovery,
dnl return traffic from ns0 back to the local stack.
AT_DATA([flows.txt], [dnl
dnl default
table=0,priority=1,action=drop
table=0,priority=10,arp,action=normal
dnl Load the output port to REG0
table=0,priority=100,ip,in_port=LOCAL,action=load:1->NXM_NX_REG0[[0..15]],goto_table:1
table=0,priority=100,ip,in_port=1,action=load:65534->NXM_NX_REG0[[0..15]],goto_table:1
@joestringer
joestringer / keybase.md
Last active May 14, 2016 07:59
keybase.md

Keybase proof [22/668]

I hereby claim:

  • I am joestringer on github.
  • I am joestringer (https://keybase.io/joestringer) on keybase.
  • I have a public key ASAN2WCYQl1cxTZELEMwmGfPyY_h5yuY-hOOF1uIGM3-kwo

To claim this, I am signing this object:

@joestringer
joestringer / ovs_key_m2n.py
Last active March 31, 2017 19:56
Convert OVS key attributes into readable text
#!/usr/bin/env python3
import sys
from enum import Enum
class Key_attr(Enum):
# From Linux include/uapi/linux/openvswitch.h
OVS_KEY_ATTR_UNSPEC = 0
OVS_KEY_ATTR_ENCAP = 1
OVS_KEY_ATTR_PRIORITY = 2
@joestringer
joestringer / get_netconsole_options.sh
Last active January 20, 2016 18:33
Get netconsole options to send logs to a given IP.
#!/bin/bash
# gnco.sh: Get netconsole options to send logs to a given IP.
# Author: Joe Stringer
#
# v1.1: Minor script tidyups.
# v1.0: Initial post.
# $1: L3 destination
function get_l2()
{
@joestringer
joestringer / load_kernel
Created January 20, 2016 18:24
Locate kernels available on the system and load one using kexec.
#!/bin/sh
if [ $# -ne 1 ]; then
echo "Usage: $0 <kernel>"
echo;
echo "Available kernels:"
ls /boot/vmlinuz-* | cut -d'-' -f2- | sed 's/^/ /'
exit 0;
fi
@joestringer
joestringer / nat_crash_repro.sh
Last active May 4, 2016 22:41
Trigger kernel crash during deferred namespace teardown after conntrack helper is unloaded
#!/bin/bash
crash=1
setup()
{
modprobe nf_conntrack_ftp
brctl addbr br0
ip link set dev br0 up
09:25 < lrichard> Enable gcov kernel profiling in kernel config (CONFIG_GCOV_KERNEL)
09:25 < lrichard> Add "GCOV_PROFILE := y" to net/openvswitch/Makefile
09:25 < lrichard> Build kernel, install, reboot
09:25 < lrichard> Execute some tests involving kernel ovs data-plane...
09:25 < lrichard> mkdir -p /tmp/lcov
09:25 < lrichard> lcov -b /path/to/kernel/build/ -q -c --rc lcov_branch_coverage=1 -o /tmp/lcov/coverage.info
09:25 < lrichard> genhtml -q --branch-coverage --num-spaces 4 -o /tmp/lcov /tmp/lcov/coverage.info
09:25 < lrichard> firefox /tmp/lcov/index.html
@joestringer
joestringer / .abignore
Created April 24, 2017 21:31
Libabigail suppressions file for libopenvswitch-2
[suppress_type]
source_location_not_regexp = openvswitch/.*\\.h
[suppress_type]
soname_not_regexp = libopenvswitch-2
[suppress_function]
soname_not_regexp = libopenvswitch-2
[suppress_variable]
soname_not_regexp = libopenvswitch-2
@joestringer
joestringer / check-abi.sh
Last active April 28, 2017 23:47 — forked from apconole/check-abi.sh
Make a bunch of minor usability/speedup changes
#! /bin/sh
## Check current git branch against original release abi
# Copyright (C) 2017, Red Hat, Inc
# Copyright (C) 2017, Nicira, Inc
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "Run as root" 2>&1
exit 1
fi
if [ ! -e /etc/init/ttyS0.conf ]; then
cat << EOF > /etc/init/ttyS0.conf
# ttyS0 - getty