rp-pppoe-server.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. 'use strict';
  2. 'require form';
  3. 'require network';
  4. 'require tools.widgets as widgets';
  5. 'require view';
  6. return view.extend({
  7. load: function() {
  8. return Promise.all([
  9. network.getNetworks(),
  10. ]);
  11. },
  12. render: function (loaded_promises) {
  13. var m, s, o;
  14. const networks = loaded_promises[0];
  15. m = new form.Map('pppoe', _('Roaring Penguin PPPoE Server'),
  16. _('PPPoE Server Configuration'));
  17. s = m.section(form.TypedSection, 'pppoe_server', _('Server Configuration'));
  18. s.anonymous = true;
  19. s.addremove = true;
  20. o = s.option(form.Flag, 'enabled', _('Enabled'));
  21. o = s.option(widgets.DeviceSelect, 'interface', _('Interface'), _('Interface on which to listen.'));
  22. o.optional = true;
  23. o.nocreate = true;
  24. o.rmempty = true;
  25. o.depends({ enabled: '1' });
  26. o = s.option(form.Value, 'localip', _('IP of listening side'), _('If specified as <code>0.0.0.0</code> the selection of local IP address is delegated to <code>pppd</code>'));
  27. o.datatype = 'ipaddr';
  28. o.placeholder = '10.0.0.1';
  29. o.value('10.0.0.1');
  30. o.value('0.0.0.0');
  31. o.depends({ enabled: '1' });
  32. o = s.option(form.Value, 'firstremoteip', _('First remote IP'), _('If specified as <code>0.0.0.0</code> remote IP allocation will be delegated to <code>pppd</code>'));
  33. o.datatype = 'ipaddr';
  34. o.placeholder = '10.67.15.1';
  35. o.value('10.67.15.1');
  36. o.value('0.0.0.0');
  37. o.rmempty = true;
  38. o.depends({ enabled: '1' });
  39. o = s.option(form.Value, 'ac_name', _('Access Concentrator Name'));
  40. o.rmempty = true;
  41. o.value('', _('Default: hostname'));
  42. o.depends({ enabled: '1' });
  43. o = s.option(form.DynamicList, 'service_name', _('Service Name'), _('Each one causes the named service to be advertised in a Service-Name tag in the PADO frame. The first one specifies the default service, and is used if the PPPoE client requests a Service-Name of length zero.'));
  44. o.optional = true;
  45. o.rmempty = true;
  46. o.depends({ enabled: '1' });
  47. o = s.option(form.Value, 'maxsessions', _('Maximum Sessions'), _('Maximum concurrent sessions'));
  48. o.datatype = 'range(1,65534)';
  49. o.placeholder = 64;
  50. o.value('', _('Default: 64'));
  51. o.optional = true;
  52. o.rmempty = true;
  53. o.depends({ enabled: '1' });
  54. o = s.option(form.Value, 'maxsessionsperpeer', _('Maximum sessions per peer'));
  55. o.optional = true
  56. o.datatype = 'range(0,65534)';
  57. o.placeholder = 0;
  58. o.value('0', _('No limit'));
  59. o.value('10');
  60. o.value('100');
  61. o.rmempty = true;
  62. o.depends({ enabled: '1' });
  63. o = s.option(form.Flag, 'use_non_uci_config', _('Use Non-UCI Config'), '<code>/etc/default/pppoe-server</code>');
  64. o.optional = true;
  65. o.rmempty = true;
  66. o.depends({ enabled: '1' });
  67. o = s.option(form.Value, 'optionsfile', _('Options file'));
  68. o.placeholder = '/etc/ppp/pppoe-server-options';
  69. o.value('/etc/ppp/options');
  70. o.value('/etc/ppp/pppoe-server-options');
  71. o.optional = true;
  72. o.rmempty = true;
  73. o.depends({ enabled: '1' });
  74. o = s.option(form.Flag, 'randomsessions', _('Random session selection'), _('Tells the PPPoE server to randomly permute session numbers.'));
  75. o.optional = true;
  76. o.rmempty = true;
  77. o.depends({ enabled: '1' });
  78. o = s.option(form.Flag, 'unit', _('Unit'), _('Invokes <code>pppd</code> with the unit flag'));
  79. o.optional = true;
  80. o.rmempty = true;
  81. o.depends({ enabled: '1' });
  82. o = s.option(form.Value, 'offset', _('Offset'), _('PPP Offset'), _('Instead of numbering PPPoE sessions starting at 1, numbering starts at %s'.format('<code>offset</code>+1')));
  83. o.optional = true;
  84. o.datatype = 'uinteger';
  85. o.placeholder = 0;
  86. o.value('0');
  87. o.depends({ enabled: '1' });
  88. o = s.option(form.Value, 'timeout', _('Timeout'), _('Causes <code>pppoe</code> to exit if no session traffic is detected for %s seconds.'.format('<code>timeout</code>')));
  89. // no default timeout is assumed
  90. o.optional = true;
  91. o.datatype = 'uinteger';
  92. o.value('0', _('No timeout'));
  93. o.value('60');
  94. o.rmempty = true;
  95. o.depends({ enabled: '1' });
  96. o = s.option(form.Value, 'mss', _('MSS'), _('Max Segment Size'));
  97. o.optional = true;
  98. o.datatype = 'uinteger';
  99. o.placeholder = 1468;
  100. o.value('1412');
  101. o.value('1468');
  102. o.rmempty = true;
  103. o.depends({ enabled: '1' });
  104. o = s.option(form.Flag, 'sync', _('Synchronous PPP encapsulation'), _('Reduces CPU usage, but may cause a race condition on slow CPUs'));
  105. o.depends({ enabled: '1' });
  106. return m.render();
  107. }
  108. });