Removed code duplication in ipv4 module
Removed duplicated code from TCP