network: update error check code for ipv4 and ipv6