Opened 7 years ago

Closed 5 years ago

Last modified 4 years ago

#9811 closed defect (fixed)

miniupnpd: upnp_lease_file option is currently unsupported

Reported by: anonymous Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: Cc:


'upnp_lease_file' UCI option is implemented in /etc/init.d/miniupnpd
but -DENABLE_LEASEFILE is missing from miniupnpd makefile

enabling upnp.leasefile would also require a patch to act_delete in /usr/lib/lua/luci/controller/upnp.lua to remove deleted redirects also in the lease file (otherwise deleted redirects will be resurrected upon miniupnpd restart).

Attachments (0)

Change History (4)

comment:1 Changed 7 years ago by anonymous

if upnp.leasefile support is enabled miniupnpd expects to find a 0-byte upnp.leasefile or else it will complain (daemon.err miniupnpd: could not open lease file).

The error is harmless as the upnp.leasefile will be created automatically as soon miniupnpd setup a redirect

an /etc/init.d/miniupnpd fix could nevertheless prevent such error:

		[ -n "$upnp_lease_file" ] && {
			echo "lease_file=$upnp_lease_file" >>$tmpconf
			[ -f "$upnp_lease_file" ] || touch $upnp_lease_file

comment:2 Changed 7 years ago by anonymous

This reworked act_delete() removes deleted redirects from upnp.leasefile if upnp_lease_file option is set.

it relies on luci.model.uci, luci.fs and sed in place editing (-i)

function act_delete()
	local path = luci.dispatcher.context.requestpath
	local idx = tonumber(path[#path])

	local upnp_lease_file = luci.model.uci.cursor():get_first("upnpd", "upnpd", "upnp_lease_file")
	if upnp_lease_file ~= nil then require("luci.fs") end

	if idx and idx > 0 then"iptables -t filter -D MINIUPNPD %d 2>/dev/null" % idx)"iptables -t nat -D MINIUPNPD %d 2>/dev/null" % idx)
		if upnp_lease_file ~= nil and luci.fs.isfile(upnp_lease_file) then"sed -i '%dd' %s" %{ idx, upnp_lease_file })
	luci.http.status(400, "Bad request")

comment:3 Changed 5 years ago by jow

  • Resolution set to fixed
  • Status changed from new to closed

comment:4 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

as closed .
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.