3 # Create, update or delete an ethernet address
5 require './nis-lib.pl';
8 ($t, $lnums, $ether) = &table_edit_setup($in{'table'}, $in{'line'}, '\s+');
10 # Just delete the ether
11 &table_delete($t, $lnums);
14 # Validate inputs and save the host
15 &error_setup($text{'ethers_err'});
16 lc($in{'mac'}) =~ /^([0-9a-f]{2}:){5}[0-9a-f]{2}$/ ||
17 &error($text{'ethers_emac'});
18 &to_ipaddress($in{'ip'}) || &to_ip6address($in{'ip'}) ||
19 &error($text{'ethers_eip'});
20 @ether = ( $in{'mac'}, $in{'ip'} );
21 if ($in{'line'} eq '') {
22 &table_add($t, "\t", \@ether);
25 &table_update($t, $lnums, "\t", \@ether);
28 &apply_table_changes() if (!$config{'manual_build'});
29 &redirect("edit_tables.cgi?table=$in{'table'}");