6 var callFileRead = rpc.declare({
11 filter: function(value) { return value.trim() }
14 return network.registerProtocol('dhcp', {
16 return _('DHCP client');
19 renderFormOptions: function(s) {
20 var dev = this.getL2Device() || this.getDevice(), o;
22 o = s.taboption('general', form.Value, 'hostname', _('Hostname to send when requesting DHCP'));
23 o.datatype = 'hostname';
24 o.load = function(section_id) {
25 return callFileRead('/proc/sys/kernel/hostname').then(L.bind(function(hostname) {
26 this.placeholder = hostname;
27 return form.Value.prototype.load.apply(this, [section_id]);
31 o = s.taboption('advanced', form.Flag, 'broadcast', _('Use broadcast flag'), _('Required for certain ISPs, e.g. Charter with DOCSIS 3'));
32 o.default = o.disabled;
34 o = s.taboption('advanced', form.Flag, 'defaultroute', _('Use default gateway'), _('If unchecked, no default route is configured'));
35 o.default = o.enabled;
37 o = s.taboption('advanced', form.Flag, 'peerdns', _('Use DNS servers advertised by peer'), _('If unchecked, the advertised DNS server addresses are ignored'));
38 o.default = o.enabled;
40 o = s.taboption('advanced', form.DynamicList, 'dns', _('Use custom DNS servers'));
41 o.depends('peerdns', '0');
42 o.datatype = 'ipaddr';
45 o = s.taboption('advanced', form.Value, 'metric', _('Use gateway metric'));
47 o.datatype = 'uinteger';
49 o = s.taboption('advanced', form.Value, 'clientid', _('Client ID to send when requesting DHCP'));
50 o.datatype = 'hexstring';
52 s.taboption('advanced', form.Value, 'vendorid', _('Vendor Class to send when requesting DHCP'));
54 o = s.taboption('advanced', form.Value, 'macaddr', _('Override MAC address'));
55 o.datatype = 'macaddr';
56 o.placeholder = dev ? (dev.getMAC() || '') : '';
58 o = s.taboption('advanced', form.Value, 'mtu', _('Override MTU'));
59 o.placeholder = dev ? (dev.getMTU() || '1500') : '1500';
60 o.datatype = 'max(9200)';