Skip to content

Commit

Permalink
macfilter の "action" と "on" のデフォルト値を埋める。
Browse files Browse the repository at this point in the history
旧コンフィグの macfilter では "action" と "on" は省略可能パラメタだった。
レシピコンフィグでは対応するパラメタ("action" と "interface")は省略不可
なので、デフォルト値に変換する。
  • Loading branch information
tsahara committed Nov 29, 2024
1 parent 0e55c61 commit c996dd9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 4 additions & 0 deletions seil2recipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -3264,6 +3264,10 @@ Converter.rules['macfilter'] = {
'interval': true,
'block-dhcp': 'notsupported'
});

params['action'] ||= 'pass'
params['on'] ||= 'lan0'

var k1;
if (params['interval']) { // URL 指定の場合は必ず interval パラメタがある。
k1 = conv.get_index('macfilter.entry-list');
Expand Down
15 changes: 10 additions & 5 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1458,12 +1458,16 @@ describe('ipsec', () => {
describe('macfilter', () => {
it('mac address list on config', () => {
assertconv(`
macfilter add CONF action pass src 02:04:06:08:0a:0c on lan0 logging on
macfilter add CONF action pass src 02:04:06:08:0a:0c on lan2 logging on
macfilter add MINIMAL src 00:00:00:00:00:00
---
macfilter.entry.100.action: pass
macfilter.entry.100.address: 02:04:06:08:0a:0c
macfilter.entry.100.interface: ge1
macfilter.entry.100.logging: on
macfilter.entry.100.action: pass
macfilter.entry.100.address: 02:04:06:08:0a:0c
macfilter.entry.100.interface: ge2
macfilter.entry.100.logging: on
macfilter.entry.200.action: pass
macfilter.entry.200.address: 00:00:00:00:00:00
macfilter.entry.200.interface: ge1
`);
});

Expand All @@ -1472,6 +1476,7 @@ describe('macfilter', () => {
macfilter add BYURL action block src http://user:[email protected]/mac.txt interval 1h
---
macfilter.entry-list.100.action: block
macfilter.entry-list.100.interface: ge1
macfilter.entry-list.100.update-interval: 1h
macfilter.entry-list.100.url: http://user:[email protected]/mac.txt
`);
Expand Down

0 comments on commit c996dd9

Please sign in to comment.