Wolfgang Denk wrote: > Dear Stefan Althoefer, > > In message <[EMAIL PROTECTED]> you wrote: >> This patches cmd_nvedit to reject changes for "ethaddr." in addition to >> "ethaddr" >> and "serial#". This is intendend to protect changes to additional ethernet >> addresses (e.g. "ethernet1"). > > The patch is bogus, as additional ethernet addrssses are eth1addr, > eth2addr, etc. and not ethaddr1, etc. > > > Also, please don't remove perfectly god comments. > > NAK. > > Best regards, > > Wolfgang Denk
Arrgh, I was thinking I was so clever with strncmp() and it turns out I was being clever based on a totally bogus assumption (wrong format). :-( I *hate* it when that happens. The following should work for eth[0-9]+addr (untested): int ethnum; : : /* "eth[0-9]+addr" is always protected */ if ((sscanf(name, "eth%daddr", ðnum) == 1) && (ethnum < MAX_ETH_ADDRS)) protected = 1; Notes: * The "ethaddr" case is handled prior to the above snippet of code. * I took out the added check "if (strlen (name) == 8)", I'm not sure why that was in there, it would limit us to 10 ethernets. If extra validation is desired, ethnum could be checked to be less than MAX_ETH_ADDRS. On reflection, it seems like a good idea so I added it above. * This is somewhat better than the strncmp() trick because the sscanf() will only convert digits. gvb _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot