first commit of the gateway, extracted from LuaUPnP