1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML
4.0//EN'
>
4 Copyright (C) 2006-2010 Jonathan Zarate
5 http://www.polarcloud.com/tomato/
7 For use with Tomato Firmware only.
8 No part of this file may be used without permission.
12 <meta http-equiv='content-type' content='text/html;charset=utf-
8'
>
13 <meta name='robots' content='noindex,nofollow'
>
14 <title>[<%
ident(); %>] Advanced: MAC Address
</title>
15 <link rel='stylesheet' type='text/css' href='tomato.css'
>
16 <link rel='stylesheet' type='text/css' href='color.css'
>
17 <script type='text/javascript' src='tomato.js'
></script>
21 <script type='text/javascript' src='debug.js'
></script>
23 <script type='text/javascript'
>
25 // <% nvram("et0macaddr,mac_wan,mac_wl"); %>
32 function et0plus(plus
)
34 var mac
= nvram
.et0macaddr
.split(':');
35 if (mac
.length
!= 6) return '';
37 for (var i
= 5; i
>= 3; --i
) {
38 var n
= (parseInt(mac
[i
], 16) + 1) & 0xFF;
46 function bdefault(which
)
48 E('_f_mac_' + which
).value
= defmac
[which
];
49 verifyFields(null, true);
58 for (i
= 5; i
> 0; --i
)
59 mac
.push(Math
.floor(Math
.random() * 255).hex(2));
60 E('_f_mac_' + which
).value
= mac
.join(':');
61 verifyFields(null, true);
64 function bclone(which
)
66 E('_f_mac_' + which
).value
= '<% compmac(); %>';
67 verifyFields(null, true);
70 function verifyFields(focused
, quiet
)
72 if (v_mac('_f_mac_wan', quiet
) && v_mac('_f_mac_wl', quiet
)) {
73 if (E('_f_mac_wan').value
!= E('_f_mac_wl').value
) return 1;
74 ferror
.set('_f_mac_wan', 'Addresses must be unique', quiet
);
81 if (!verifyFields(null, false)) return;
82 if (!confirm("Warning: Changing the MAC address may require that you reboot all devices, computers or modem connected to this router. Continue anyway?")) return
85 fom
.mac_wan
.value
= (fom
._f_mac_wan
.value
== defmac
.wan
) ? '' : fom
._f_mac_wan
.value
;
86 fom
.mac_wl
.value
= (fom
._f_mac_wl
.value
== defmac
.wl
) ? '' : fom
._f_mac_wl
.value
;
92 <form id='_fom' method='post' action='tomato.cgi'
>
93 <table id='container' cellspacing=
0>
94 <tr><td colspan=
2 id='header'
>
95 <div class='title'
>Tomato
</div>
96 <div class='version'
>Version <%
version(); %></div>
98 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
100 <div id='ident'
><%
ident(); %></div>
104 <input type='hidden' name='_nextpage' value='advanced-mac.asp'
>
105 <input type='hidden' name='_nextwait' value='
10'
>
106 <input type='hidden' name='_service' value='*'
>
108 <input type='hidden' name='mac_wan'
>
109 <input type='hidden' name='mac_wl'
>
111 <div class='section-title'
>MAC Address
</div>
112 <div class='section'
>
113 <script type='text/javascript'
>
114 createFieldTable('', [
115 { title
: 'WAN Port', indent
: 1, name
: 'f_mac_wan', type
: 'text', maxlen
: 17, size
: 20,
116 suffix
: ' <input type="button" value="Default" onclick="bdefault(\'wan\')"> <input type="button" value="Random" onclick="brand(\'wan\')"> <input type="button" value="Clone PC" onclick="bclone(\'wan\')">',
117 value
: nvram
.mac_wan
|| defmac
.wan
},
118 { title
: 'Wireless Interface', indent
: 1, name
: 'f_mac_wl', type
: 'text', maxlen
: 17, size
: 20,
119 suffix
:' <input type="button" value="Default" onclick="bdefault(\'wl\')"> <input type="button" value="Random" onclick="brand(\'wl\')"> <input type="button" value="Clone PC" onclick="bclone(\'wl\')">',
120 value
: nvram
.mac_wl
|| defmac
.wl
}
124 <table border=
0 cellpadding=
1>
125 <tr><td>Router's MAC Address:
</td><td><b><%
nv('et0macaddr'); %></b></td></tr>
126 <tr><td>Computer's MAC Address:
</td><td><b><%
compmac(); %></b></td></tr>
135 <tr><td id='footer' colspan=
2>
136 <span id='footer-msg'
></span>
137 <input type='button' value='Save' id='save-button' onclick='save()'
>
138 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'
>
142 <script type='text/javascript'
>verifyFields(null, 1);</script>