This code is ported from the net_util.rs in virtio-devices. The point being to move it to the net_util crate so that it can later be reused from vhost-user-net backend. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>