File elilo-mac-conf.diff of Package elilo

---
 glue_netfs.c |   37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

--- a/glue_netfs.c
+++ b/glue_netfs.c
@@ -72,7 +72,7 @@ convert_mac2hex(UINT8 *hw_addr,INTN l, C
 	for (i=0 ; i < l; i++) {
 		str[3*i] = hexa[(hw_addr[i] & 0xf0)>>4];
 		str[3*i+1] = hexa[hw_addr[i] & 0x0f];
-		str[3*i+2] = ':';
+		str[3*i+2] = '-';
 	}
 	str[3*l-1]='\0';
 }
@@ -213,32 +213,35 @@ netfs_setdefaults(VOID *intf, config_fil
 		 * will try machine/subnet specific files first.
 		 * the filenames are constructed based on the IP(v4) address
 		 */
-		convert_ip2hex(ipaddr, m, str);
 #if 1
 		i = 0;
+		if (non_zero(info.hw_addr, 6)) {
+			convert_mac2hex(info.hw_addr,6,str);
+			/* Blindly prepend ARP type code for Ethernet (0x01)
+			 * (at least for now...)
+			 */
+			StrnCpy(config[i].fname, L"01-", 3);
+			StrnCat(config[i].fname, str, maxlen-10);
+			StrnCat(config[i++].fname, CONFIG_EXTENSION, maxlen-1);
+		}
 		if (non_zero(ipaddr, m)) {
-			int nr = (m==16)? 10 : 6;
-			int st = (m==16)? 2 : 1;
-			m <<= 1;
-			StrnCpy(config[i].fname, str, m);
-			StrnCat(config[i++].fname,
-				CONFIG_EXTENSION, maxlen - m);
-			while (i <= nr) {
-				int stub = m - (i+1)*st;
+			int step = (m==16)? 4 : 2;
+			int stub = m<<1;
+			convert_ip2hex(ipaddr, stub, str);
+			StrnCpy(config[i].fname, str, stub);
+			StrnCat(config[i++].fname, CONFIG_EXTENSION, maxlen-1);
+			while ( i+3 < MAX_DEFAULT_CONFIGS && stub > step) {
+				stub -= step;
 				StrnCpy(config[i].fname, str, stub);
 				StrnCat(config[i++].fname,
-					CONFIG_ARCH_EXTENSION, maxlen - m);
+					CONFIG_ARCH_EXTENSION, maxlen-1);
 				StrnCpy(config[i].fname, str, stub);
 				StrnCat(config[i++].fname,
-					CONFIG_EXTENSION, maxlen - m);
+					CONFIG_EXTENSION, maxlen-1);
 			}
 		}
-		if (non_zero(info.hw_addr, 6)) {
-			convert_mac2hex(info.hw_addr,6,str);
-			StrnCpy(config[i].fname, str, maxlen-1);
-			StrnCpy(config[i++].fname+17, CONFIG_EXTENSION, 6);
-		}
 #else
+		convert_ip2hex(ipaddr, m, str);
 		StrnCpy(config[0].fname, str, maxlen-1);
 		StrnCpy(config[0].fname+8, CONFIG_EXTENSION, 6);