Skip to content

Commit

Permalink
luci-mod-network: gate bonding behind kmod presence
Browse files Browse the repository at this point in the history
The kmod install link only displays in new device dialogues so as not
to be too prominent.

Closes #6996
Closes #7086

Signed-off-by: Paul Donald <[email protected]>
  • Loading branch information
systemcrash committed Dec 19, 2024
1 parent fb4cf43 commit ab15b5e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions modules/luci-base/root/usr/share/rpcd/ucode/luci
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ const methods = {
firewall: access('/sbin/fw3') == true,
firewall4: access('/sbin/fw4') == true,
opkg: access('/bin/opkg') == true,
bonding: access('/sys/module/bonding'),
mii-tool: access('/usr/sbin/mii-tool'),

This comment has been minimized.

Copy link
@jow-

jow- Dec 20, 2024

Contributor

This unquoted mii-toolkey is a likely syntax error

This comment has been minimized.

Copy link
@systemcrash

systemcrash Dec 20, 2024

Author Contributor

That is correct - ucode does not like it.

offloading: access('/sys/module/xt_FLOWOFFLOAD/refcnt') == true || access('/sys/module/nft_flow_offload/refcnt') == true,
br2684ctl: access('/usr/sbin/br2684ctl') == true,
swconfig: access('/sbin/swconfig') == true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,14 @@ return baseclass.extend({
s.tab('brport', _('Bridge port specific options'));
s.tab('bridgevlan', _('Bridge VLAN filtering'));

o = this.replaceOption(s, 'devgeneral', form.ListValue, 'type', _('Device type'));
o = this.replaceOption(s, 'devgeneral', form.ListValue, 'type', _('Device type'),
!L.hasSystemFeature('bonding') && isNew ? '<a href="' + L.url("admin", "system", "package-manager", "?query=kmod-bonding") + '">'+
_('For bonding, install %s').format('<code>kmod-bonding</code>') + '</a>' : null);
o.readonly = !isNew;
o.value('', _('Network device'));
o.value('bonding', _('Aggregation device'));
if (L.hasSystemFeature('bonding')) {
o.value('bonding', _('Bonding/Aggregation device'));
}
o.value('bridge', _('Bridge device'));
o.value('8021q', _('VLAN (802.1q)'));
o.value('8021ad', _('VLAN (802.1ad)'));
Expand Down Expand Up @@ -864,7 +868,9 @@ return baseclass.extend({
};
o.depends('type', 'bonding');

o = this.replaceOption(s, 'devadvanced', form.ListValue, 'monitor_mode', _('Link monitoring mode'));
o = this.replaceOption(s, 'devadvanced', form.ListValue, 'monitor_mode', _('Link monitoring mode'),
!L.hasSystemFeature('mii-tool') ? '<a href="' + L.url("admin", "system", "package-manager", "?query=mii-tool") + '">'+
_('Install %s').format('<code>mii-tool</code>') + '</a>' : null);
o.default = '';
o.value('arp', _('ARP link monitoring'));
o.value('mii', _('MII link monitoring'));
Expand Down

0 comments on commit ab15b5e

Please sign in to comment.