Alternate DHCP port change?

Per Dalgas Jakobsen <[email protected]> Tue, 21 Feb 2006 22:53:30 +0100
Newsgroups gmane.network.etherboot.devel
Message-ID <[email protected]>
Hi,

Suggestion:
Change ALTERNATE_DHCP_PORTS_1067_1068 to ALTERNATE_DHCP_PORTS=<port>

If this is done, multiple teams would be able to set-up independant
development systems for their devices, even when they do not have
access/permission to change the DHCP server setup.

I have attached a patch, which has *ONLY* been tested by a
compilation... Consider yourself warned ;-)
The patch is pretty straight forward, so it may even work...

~Per
etherboot-5.4.1-alternate-port.patch (text/x-patch, 2.7 KB)
diff -Nur etherboot-5.4.1.orig/src/arch/i386/firmware/pcbios/basemem.c etherboot-5.4.1.new/src/arch/i386/firmware/pcbios/basemem.c
--- etherboot-5.4.1.orig/src/arch/i386/firmware/pcbios/basemem.c	2005-04-02 12:47:35.000000000 +0200
+++ etherboot-5.4.1.new/src/arch/i386/firmware/pcbios/basemem.c	2006-02-21 22:35:14.000000000 +0100
@@ -16,8 +16,8 @@
 #define FREE_BASE_MEMORY ( (uint32_t) ( *fbms << 10 ) )
 
 /* Prototypes */
-void * _allot_base_memory ( size_t size );
-void _forget_base_memory ( void *ptr, size_t size );
+static void * _allot_base_memory ( size_t size );
+static void _forget_base_memory ( void *ptr, size_t size );
 
 typedef struct free_base_memory_block {
 	uint32_t	magic;
@@ -221,7 +221,7 @@
  * entity (if we can detect that it has done so) so that we get the
  * chance to free up our own blocks.
  */
-static void free_unused_base_memory ( void ) {
+void free_unused_base_memory ( void ) {
 	free_base_memory_block_t *free_block = NULL;
 
 	/* Try to release memory back to the BIOS.  Free all
diff -Nur etherboot-5.4.1.orig/src/Config etherboot-5.4.1.new/src/Config
--- etherboot-5.4.1.orig/src/Config	2005-08-29 03:47:37.000000000 +0200
+++ etherboot-5.4.1.new/src/Config	2006-02-21 22:39:55.000000000 +0100
@@ -49,8 +49,10 @@
 #
 #	Boot autoconfiguration protocol options:
 #
-#	-DALTERNATE_DHCP_PORTS_1067_1068
-#			Use ports 1067 and 1068 for DHCP instead of 67 and 68.
+#	-DALTERNATE_DHCP_PORTS=<server-port>
+#			Use alternative ports for DHCP instead of 67 and 68.
+#			The value is the DHCP server port. Etherboot will
+#			respond on <server-port+1>.
 #			As these ports are non-standard, you need to configure
 #			your DHCP server to use them. This option gets around
 #			existing DHCP servers which cannot be touched, for
@@ -309,7 +311,7 @@
 
 # Enabling this creates non-standard images which use ports 1067 and 1068
 # for DHCP/BOOTP
-# CFLAGS+=	-DALTERNATE_DHCP_PORTS_1067_1068
+CFLAGS+=	-DALTERNATE_DHCP_PORTS=1067
 
 # Enabling this makes the boot ROM require a Vendor Class Identifier
 # of "Etherboot" in the Vendor Encapsulated Options
diff -Nur etherboot-5.4.1.orig/src/include/bootp.h etherboot-5.4.1.new/src/include/bootp.h
--- etherboot-5.4.1.orig/src/include/bootp.h	2005-04-02 12:50:53.000000000 +0200
+++ etherboot-5.4.1.new/src/include/bootp.h	2006-02-21 22:30:46.000000000 +0100
@@ -1,11 +1,11 @@
 #ifndef	_BOOTP_H
 #define	_BOOTP_H
 
-#ifdef	ALTERNATE_DHCP_PORTS_1067_1068
+#ifdef	ALTERNATE_DHCP_PORTS
 #undef	NON_STANDARD_BOOTP_SERVER
-#define	NON_STANDARD_BOOTP_SERVER	1067
+#define	NON_STANDARD_BOOTP_SERVER	(ALTERNATE_DHCP_PORTS)
 #undef	NON_STANDARD_BOOTP_CLIENT
-#define	NON_STANDARD_BOOTP_CLIENT	1068
+#define	NON_STANDARD_BOOTP_CLIENT	(ALTERNATE_DHCP_PORTS+1)
 #endif
 
 #ifdef	NON_STANDARD_BOOTP_SERVER