-
-
Notifications
You must be signed in to change notification settings - Fork 113
pirania: remove dead code and legacy artifacts #1249
Description
Summary
While preparing the pirania package for a merge, several dead code items and legacy artifacts were identified that should be cleaned up in a follow-up.
Items
1. Broken CGI endpoint: client_ip
File: packages/pirania/files/www/cgi-bin/pirania/client_ip
This CGI script imports voucher.logic and voucher.db (lines 4-5) — neither module exists. The modules were renamed to voucher.vouchera, voucher.store, etc. long ago. If this endpoint is ever hit, it produces a 500 error. It is not called by any portal page or JS in the current codebase.
Action: Delete the file.
2. Dead portal_url ubus API (legacy, non-functional)
File: packages/pirania/files/usr/libexec/rpcd/pirania (lines 55-64, 102-103)
The show_url and change_url ubus methods read/write pirania.base_config.portal_url, but this UCI key does not exist in the config. The actual portal redirect uses portal_domain + url_auth/url_portal. These methods are effectively no-ops.
Action: Remove show_url and change_url from the rpcd script and the methods table.
3. Stale UCI option: append_nft_rules
File: packages/pirania/files/etc/config/pirania (line 11)
option append_nft_rules '0' # if set to 1, iptables rules will be Appended instead of Inserted
The comment still says "iptables" and the option has no effect in the current nftables implementation. The captive-portal script always recreates the table from scratch.
Action: Remove this option from the UCI config.
4. Dead code: functools.lua is never imported
File: packages/pirania/files/usr/lib/lua/voucher/functools.lua
This 90-line module provides curry, reverse, map, filter, and search functions, but nothing in the entire codebase requires or imports it.
Action: Delete the file.
Context
Identified during review of branch hotfix/pirania before merge. These are safe mechanical cleanups that do not affect any working functionality.
5. Stale ACL references to legacy show_url method
File: packages/pirania/files/usr/share/rpcd/acl.d/pirania.json (lines 6, 14)
The ACL file grants access to the legacy show_url method in both the unauthenticated and lime-app roles. When items 1-2 above are resolved (removing show_url/change_url from rpcd), these ACL entries should also be cleaned up.
Action: Remove show_url from the ACL entries and replace with appropriate current methods if needed.'