Skip to content

Instantly share code, notes, and snippets.

View router.py
#!/usr/bin/env python3
'''
Basic IPv4 router (static routing) in Python.
'''
import sys
import os
import time
from switchyard.lib.packet import *
@smihir
smihir / notes.txt
Created Nov 27, 2015
BuddyAllocator Analysis Scripts
View notes.txt
- Data to be collected on Ubuntu vm running on VirtualBox. (2 GB RAM)
#uname -a
Linux adminuser-VirtualBox 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:08:14 UTC 2014 i686 i686 i686 GNU/Linux
- The 'heart' of the zoned buddy allocator is the following function(in mm/page_alloc.c)
struct page *
__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
struct zonelist *zonelist, nodemask_t *nodemask)
- The following tracepoint is present in this function:
@smihir
smihir / myswitch.py
Last active Apr 16, 2016
cs640 assignment 1
View myswitch.py
#!/usr/bin/env python3
'''
Ethernet learning switch in Python: HW3.
Note that this file currently has the code to implement a "hub"
in it, not a learning switch. (I.e., it's currently a switch
that doesn't learn.)
'''
from switchyard.lib.address import *
@smihir
smihir / skb_dump.c
Created Jan 30, 2015
code to dump a skb, so that with minimum postprocessing it can be fed to text2pcap for converting into a pcap
View skb_dump.c
// This code snippet can be used to dump a skb, so that with minimum postprocessing
// it can be fed to text2pcap for converting into a pcap file which can be analyzed
// in wireshark
do {
int i;
printk("\n");
printk("000000 ");
for (i = 0 ; i < skb->len; i++) {
printk("%02x ", ((u8*)skb->data)[i]);
You can’t perform that action at this time.