scripts: move some utility functions out of netifd-proto.sh into utils.sh