Skip to content

Commit

Permalink
luci-proto-vxlan: fix tos write and load handlers
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Donald <[email protected]>
  • Loading branch information
systemcrash committed Nov 7, 2024
1 parent 9ddbc11 commit 1de73e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,13 @@ return network.registerProtocol('vxlan', {
return false;
};
o.write = function(section_id, value) {
return uci.set('network', section_id, 'tos', parseInt(value).toString(16).padStart(2, '0'));
if (!value) return
value = value === 'inherit' ? value : parseInt(value).toString(16).padStart(2, '0');
return uci.set('network', section_id, 'tos', value);
};
o.load = function(section_id) {
return parseInt(uci.get('network', section_id, 'tos'), 16).toString();
const value = uci.get('network', section_id, 'tos');
return value ? (value === 'inherit' ? value : parseInt(value, 16).toString()) : null;
};

o = s.taboption('advanced', form.Flag, 'rxcsum', _('Enable rx checksum'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,13 @@ return network.registerProtocol('vxlan6', {
return false;
};
o.write = function(section_id, value) {
return uci.set('network', section_id, 'tos', parseInt(value).toString(16).padStart(2, '0'));
if (!value) return
value = value === 'inherit' ? value : parseInt(value).toString(16).padStart(2, '0');
return uci.set('network', section_id, 'tos', value);
};
o.load = function(section_id) {
return parseInt(uci.get('network', section_id, 'tos'), 16).toString();
const value = uci.get('network', section_id, 'tos');
return value ? (value === 'inherit' ? value : parseInt(value, 16).toString()) : null;
};

o = s.taboption('advanced', form.Flag, 'rxcsum', _('Enable rx checksum'));
Expand Down

0 comments on commit 1de73e1

Please sign in to comment.