6 var callHostname = rpc.declare({
12 return network.registerProtocol('dhcp', {
14 return _('DHCP client');
17 renderFormOptions: function(s) {
18 var dev = this.getL2Device() || this.getDevice(), o;
20 o = s.taboption('general', form.Value, 'hostname', _('Hostname to send when requesting DHCP'));
21 o.datatype = 'hostname';
22 o.load = function(section_id) {
23 return callHostname().then(L.bind(function(hostname) {
24 this.placeholder = hostname;
25 return form.Value.prototype.load.apply(this, [section_id]);
29 o = s.taboption('advanced', form.Flag, 'broadcast', _('Use broadcast flag'), _('Required for certain ISPs, e.g. Charter with DOCSIS 3'));
30 o.default = o.disabled;
32 o = s.taboption('advanced', form.Flag, 'defaultroute', _('Use default gateway'), _('If unchecked, no default route is configured'));
33 o.default = o.enabled;
35 o = s.taboption('advanced', form.Flag, 'peerdns', _('Use DNS servers advertised by peer'), _('If unchecked, the advertised DNS server addresses are ignored'));
36 o.default = o.enabled;
38 o = s.taboption('advanced', form.DynamicList, 'dns', _('Use custom DNS servers'));
39 o.depends('peerdns', '0');
40 o.datatype = 'ipaddr';
43 o = s.taboption('advanced', form.Value, 'metric', _('Use gateway metric'));
45 o.datatype = 'uinteger';
47 o = s.taboption('advanced', form.Value, 'clientid', _('Client ID to send when requesting DHCP'));
48 o.datatype = 'hexstring';
50 s.taboption('advanced', form.Value, 'vendorid', _('Vendor Class to send when requesting DHCP'));
52 o = s.taboption('advanced', form.Value, 'macaddr', _('Override MAC address'));
53 o.datatype = 'macaddr';
54 o.placeholder = dev ? (dev.getMAC() || '') : '';
56 o = s.taboption('advanced', form.Value, 'mtu', _('Override MTU'));
57 o.placeholder = dev ? (dev.getMTU() || '1500') : '1500';
58 o.datatype = 'max(9200)';