init code from https://code.google.com/p/packetdrill/ commit
d799c219acfa4721bc43b2cdf328c5a96751c401