[gPXE git] mainline: 7 commits to master (42fb96f..719c4e4)
git at etherboot.org
git at etherboot.org
Wed May 26 21:43:44 EDT 2010
In the Main gPXE repository, branch master has been updated.
adds 719c4e4 [efi] Fix *.efi linking
adds 3f845eb [efi] Fix link order for elf2efi
adds 8b428e1 [elf2efi] Improve error handling
adds 3266c89 [bitmap] Fix bitmaps on 64-bit platforms
adds 9e9f021 [linker] Use weak definitions instead of weak declarations
adds 8820d4c [dhcp] Don't consider invalid offers to be duplicates
adds 2991938 [compiler] Fix 64bit compile time errors
from 42fb96f [dhcp] Honor PXEBS_SKIP option in discovery control
Summary of changes:
README | 2 +-
src/Makefile.housekeeping | 7 ++--
src/arch/i386/include/pxe_call.h | 20 +----------
src/arch/i386/interface/pxe/pxe_call.c | 2 +-
src/arch/i386/interface/pxeparent/pxeparent_dhcp.c | 2 +-
src/arch/i386/interface/syslinux/comboot_call.c | 14 +++++++
src/arch/x86/Makefile.efi | 3 ++
src/arch/x86/prefix/efidrvprefix.c | 4 +-
src/arch/x86/prefix/efiprefix.c | 4 +-
src/core/bitmap.c | 2 +-
src/drivers/net/ath5k/ath5k.c | 4 +-
src/drivers/net/eepro100.c | 2 +-
src/drivers/net/myri10ge.c | 4 +-
src/drivers/net/skge.c | 6 ++--
src/drivers/net/skge.h | 2 +-
src/include/compiler.h | 33 +----------------
src/include/gpxe/bitmap.h | 2 +-
src/include/gpxe/dhcp.h | 2 +-
src/include/gpxe/sec80211.h | 37 ++------------------
src/include/usr/autoboot.h | 3 +-
src/net/80211/net80211.c | 11 ++++++
src/net/80211/wpa.c | 6 ++--
src/net/udp/dhcp.c | 11 ++++--
src/usr/autoboot.c | 9 ++++-
src/util/elf2efi.c | 5 ++-
25 files changed, 80 insertions(+), 117 deletions(-)
- Log -----------------------------------------------------------------
------
commit 719c4e4ce218e26ca6b8b03b48a261443bd437d5
Author: Piotr JaroszyÅski <p.jaroszynski at gmail.com>
Date: Tue Mar 30 18:18:43 2010 +0200
Committer: Joshua Oreman <oremanj at rwcr.net>
[efi] Fix *.efi linking
The linker chooses to look for _start first and always picks
efidrvprefix.o to satisfy it (probably because it's earlier in the
archive) which causes a multiple definition error when the linker
later has to pick efiprefix.o for other symbols. Use EFI-specific
LD_FLAGS with more --defsym magic to work around that.
Signed-off-by: Piotr JaroszyÅski <p.jaroszynski at gmail.com>
Signed-off-by: Joshua Oreman <oremanj at rwcr.net>
---
src/Makefile.housekeeping | 3 ++-
src/arch/x86/Makefile.efi | 3 +++
src/arch/x86/prefix/efidrvprefix.c | 4 ++--
src/arch/x86/prefix/efiprefix.c | 4 ++--
4 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
index a573356..40bd878 100644
--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -612,7 +612,8 @@ TGT_LD_IDS = pci_vendor_id=$(firstword $(TGT_PCI_VENDOR) 0) \
#
TGT_LD_FLAGS = $(foreach SYM,$(TGT_LD_PREFIX) $(TGT_LD_DRIVERS) obj_config,\
-u $(SYM) --defsym check_$(SYM)=$(SYM) ) \
- $(patsubst %,--defsym %,$(TGT_LD_IDS))
+ $(patsubst %,--defsym %,$(TGT_LD_IDS)) \
+ $(TGT_LD_FLAGS_PRE)
# Calculate makerom flags for the specific target
# (e.g. "bin/dfe538--prism2_pci.zrom.tmp") and derive the variables:
diff --git a/src/arch/x86/Makefile.efi b/src/arch/x86/Makefile.efi
index bef8d59..8a5b559 100644
--- a/src/arch/x86/Makefile.efi
+++ b/src/arch/x86/Makefile.efi
@@ -13,6 +13,9 @@ LDFLAGS += -q -S
NON_AUTO_MEDIA += efi
NON_AUTO_MEDIA += efidrv
+# Extra LD FLAGS
+TGT_LD_FLAGS_PRE = --defsym _start=_$(TGT_PREFIX)_start
+
# Rules for building EFI files
#
$(BIN)/%.efi : $(BIN)/%.efi.tmp $(ELF2EFI)
diff --git a/src/arch/x86/prefix/efidrvprefix.c b/src/arch/x86/prefix/efidrvprefix.c
index 36d5650..b556120 100644
--- a/src/arch/x86/prefix/efidrvprefix.c
+++ b/src/arch/x86/prefix/efidrvprefix.c
@@ -29,8 +29,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
* @v systab System table
* @ret efirc EFI return status code
*/
-EFI_STATUS EFIAPI _start ( EFI_HANDLE image_handle,
- EFI_SYSTEM_TABLE *systab ) {
+EFI_STATUS EFIAPI _efidrv_start ( EFI_HANDLE image_handle,
+ EFI_SYSTEM_TABLE *systab ) {
EFI_STATUS efirc;
/* Initialise EFI environment */
diff --git a/src/arch/x86/prefix/efiprefix.c b/src/arch/x86/prefix/efiprefix.c
index 4cc9e04..742c8b1 100644
--- a/src/arch/x86/prefix/efiprefix.c
+++ b/src/arch/x86/prefix/efiprefix.c
@@ -28,8 +28,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
* @v systab System table
* @ret efirc EFI return status code
*/
-EFI_STATUS EFIAPI _start ( EFI_HANDLE image_handle,
- EFI_SYSTEM_TABLE *systab ) {
+EFI_STATUS EFIAPI _efi_start ( EFI_HANDLE image_handle,
+ EFI_SYSTEM_TABLE *systab ) {
EFI_STATUS efirc;
/* Initialise EFI environment */
------
commit 3f845eb7178f87a13da2e52ed939ae350e703781
Author: Piotr JaroszyÅski <p.jaroszynski at gmail.com>
Date: Tue Mar 30 15:34:17 2010 +0200
Committer: Joshua Oreman <oremanj at rwcr.net>
[efi] Fix link order for elf2efi
Dependencies are considered in left-to-right order so the source file
needs to come first in this case.
Signed-off-by: Piotr JaroszyÅski <p.jaroszynski at gmail.com>
Signed-off-by: Joshua Oreman <oremanj at rwcr.net>
---
src/Makefile.housekeeping | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
index c373c88..a573356 100644
--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -899,12 +899,12 @@ ELF2EFI_CFLAGS := -I$(BINUTILS_DIR)/include -I$(BFD_DIR)/include \
$(ELF2EFI32) : util/elf2efi.c $(MAKEDEPS)
$(QM)$(ECHO) " [HOSTCC] $@"
- $(Q)$(HOST_CC) $(ELF2EFI_CFLAGS) -DMDE_CPU_IA32 -O2 -o $@ $<
+ $(Q)$(HOST_CC) $< $(ELF2EFI_CFLAGS) -DMDE_CPU_IA32 -O2 -o $@
CLEANUP += $(ELF2EFI32)
$(ELF2EFI64) : util/elf2efi.c $(MAKEDEPS)
$(QM)$(ECHO) " [HOSTCC] $@"
- $(Q)$(HOST_CC) $(ELF2EFI_CFLAGS) -DMDE_CPU_X64 -O2 -o $@ $<
+ $(Q)$(HOST_CC) $< $(ELF2EFI_CFLAGS) -DMDE_CPU_X64 -O2 -o $@
CLEANUP += $(ELF2EFI64)
$(EFIROM) : util/efirom.c $(MAKEDEPS)
------
commit 8b428e13cef519263366abcf64b74964e66c0a85
Author: Geoff Lywood <glywood at vmware.com>
Date: Wed May 26 17:04:12 2010 -0700
Committer: Joshua Oreman <oremanj at rwcr.net>
[elf2efi] Improve error handling
Currently, if you attempt to build 64-bit EFI binaries on a 32-bit system
without a suitable cross-compiling version of libbfd.a, the gPXE build will
die with a segmentation fault in elf2efi64. This fix makes it die with a
slightly more useful error message.
Signed-off-by: Joshua Oreman <oremanj at rwcr.net>
---
src/util/elf2efi.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/util/elf2efi.c b/src/util/elf2efi.c
index bb766bd..d93391a 100644
--- a/src/util/elf2efi.c
+++ b/src/util/elf2efi.c
@@ -247,8 +247,9 @@ static bfd * open_input_bfd ( const char *filename ) {
/* The call to bfd_check_format() must be present, otherwise
* we get a segfault from later BFD calls.
*/
- if ( bfd_check_format ( bfd, bfd_object ) < 0 ) {
- eprintf ( "%s is not an object file\n", filename );
+ if ( ! bfd_check_format ( bfd, bfd_object ) ) {
+ eprintf ( "%s is not an object file: ", filename );
+ bfd_perror ( NULL );
exit ( 1 );
}
------
commit 3266c89d5c06bdd8b6aa2a64c63eed82fdba4b37
Author: Geoff Lywood <glywood at vmware.com>
Date: Tue May 4 14:18:04 2010 -0700
Committer: Joshua Oreman <oremanj at rwcr.net>
[bitmap] Fix bitmaps on 64-bit platforms
Fix mistaken truncation of bitmap blocks to integer size before
testing and comparison. A typical symptom of the error would be
TFTP transfers failing after 32 blocks.
Signed-off-by: Joshua Oreman <oremanj at rwcr.net>
---
src/core/bitmap.c | 2 +-
src/include/gpxe/bitmap.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/core/bitmap.c b/src/core/bitmap.c
index bbe9cba..cd8dd2d 100644
--- a/src/core/bitmap.c
+++ b/src/core/bitmap.c
@@ -76,7 +76,7 @@ int bitmap_test ( struct bitmap *bitmap, unsigned int bit ) {
if ( bit >= bitmap->length )
return 0;
- return ( bitmap->blocks[index] & mask );
+ return ( bitmap->blocks[index] & mask ) != 0;
}
/**
diff --git a/src/include/gpxe/bitmap.h b/src/include/gpxe/bitmap.h
index d6911a5..7b43038 100644
--- a/src/include/gpxe/bitmap.h
+++ b/src/include/gpxe/bitmap.h
@@ -33,7 +33,7 @@ typedef unsigned long bitmap_block_t;
* @v bit Bit index
* @ret mask Block mask
*/
-#define BITMAP_MASK( bit ) ( 1 << ( (bit) % BITMAP_BLKSIZE ) )
+#define BITMAP_MASK( bit ) ( (bitmap_block_t)1 << ( (bit) % BITMAP_BLKSIZE ) )
/** A bitmap */
struct bitmap {
------
commit 9e9f021ba78ffdcb5a2b6a120400a9c2166eef03
Author: Joshua Oreman <oremanj at rwcr.net>
Date: Wed May 26 17:52:44 2010 -0700
Committer: Joshua Oreman <oremanj at rwcr.net>
[linker] Use weak definitions instead of weak declarations
This removes the need for inline safety wrappers, marginally
reducing the size penalty of weak functions, and works around an
apparent binutils bug that causes undefined weak symbols to not
actually be NULL when compiling with -fPIE (as EFI builds do).
A bug in versions of binutils prior to 2.16 (released in 2005)
will cause same-file weak definitions to not work with those
toolchains. Update the README to reflect our new dependency on
binutils >= 2.16.
Signed-off-by: Joshua Oreman <oremanj at rwcr.net>
---
README | 2 +-
src/arch/i386/include/pxe_call.h | 20 +----------
src/arch/i386/interface/pxe/pxe_call.c | 2 +-
src/arch/i386/interface/pxeparent/pxeparent_dhcp.c | 2 +-
src/arch/i386/interface/syslinux/comboot_call.c | 14 +++++++
src/include/compiler.h | 33 +----------------
src/include/gpxe/dhcp.h | 2 +-
src/include/gpxe/sec80211.h | 37 ++------------------
src/include/usr/autoboot.h | 3 +-
src/net/80211/net80211.c | 11 ++++++
src/net/udp/dhcp.c | 5 +++
src/usr/autoboot.c | 9 ++++-
12 files changed, 49 insertions(+), 91 deletions(-)
diff --git a/README b/README
index b3ae215..3dba341 100644
--- a/README
+++ b/README
@@ -29,7 +29,7 @@ toolchain is required.
The following packages (at least) are required:
- a gcc tool chain (gcc 3.x or gcc 4.x)
- - binutils
+ - binutils (version 2.16 or later)
- perl
- syslinux
- mtools
diff --git a/src/arch/i386/include/pxe_call.h b/src/arch/i386/include/pxe_call.h
index 4d24561..ceb0ef8 100644
--- a/src/arch/i386/include/pxe_call.h
+++ b/src/arch/i386/include/pxe_call.h
@@ -34,24 +34,6 @@ extern void pxe_activate ( struct net_device *netdev );
extern int pxe_deactivate ( void );
extern int pxe_start_nbp ( void );
extern __asmcall void pxe_api_call ( struct i386_all_regs *ix86 );
-extern int _pxe_api_call_weak ( struct i386_all_regs *ix86 )
- __attribute__ (( weak ));
-
-/**
- * Dispatch PXE API call weakly
- *
- * @v ix86 Registers for PXE call
- * @ret present Zero if the PXE stack is present, nonzero if not
- *
- * A successful return only indicates that the PXE stack was available
- * for dispatching the call; it says nothing about the success of
- * whatever the call asked for.
- */
-static inline int pxe_api_call_weak ( struct i386_all_regs *ix86 )
-{
- if ( _pxe_api_call_weak != NULL )
- return _pxe_api_call_weak ( ix86 );
- return -1;
-}
+extern int pxe_api_call_weak ( struct i386_all_regs *ix86 );
#endif /* _PXE_CALL_H */
diff --git a/src/arch/i386/interface/pxe/pxe_call.c b/src/arch/i386/interface/pxe/pxe_call.c
index 66a9b1e..028b451 100644
--- a/src/arch/i386/interface/pxe/pxe_call.c
+++ b/src/arch/i386/interface/pxe/pxe_call.c
@@ -350,7 +350,7 @@ __asmcall void pxe_api_call ( struct i386_all_regs *ix86 ) {
* @v ix86 Registers for PXE call
* @ret present Zero (PXE stack present)
*/
-int _pxe_api_call_weak ( struct i386_all_regs *ix86 )
+int pxe_api_call_weak ( struct i386_all_regs *ix86 )
{
pxe_api_call ( ix86 );
return 0;
diff --git a/src/arch/i386/interface/pxeparent/pxeparent_dhcp.c b/src/arch/i386/interface/pxeparent/pxeparent_dhcp.c
index 6605943..dbf5903 100644
--- a/src/arch/i386/interface/pxeparent/pxeparent_dhcp.c
+++ b/src/arch/i386/interface/pxeparent/pxeparent_dhcp.c
@@ -29,7 +29,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
/**
* Present cached DHCP packet if it exists
*/
-void __weak_impl ( get_cached_dhcpack ) ( void ) {
+void get_cached_dhcpack ( void ) {
struct undi_device *undi;
struct s_PXENV_GET_CACHED_INFO get_cached_info;
int rc;
diff --git a/src/arch/i386/interface/syslinux/comboot_call.c b/src/arch/i386/interface/syslinux/comboot_call.c
index dd94d8b..e4f16da 100644
--- a/src/arch/i386/interface/syslinux/comboot_call.c
+++ b/src/arch/i386/interface/syslinux/comboot_call.c
@@ -319,6 +319,20 @@ static __asmcall void int21 ( struct i386_all_regs *ix86 ) {
/**
+ * Dispatch PXE API call weakly
+ *
+ * @v ix86 Registers for PXE call
+ * @ret present Zero if the PXE stack is present, nonzero if not
+ *
+ * A successful return only indicates that the PXE stack was available
+ * for dispatching the call; it says nothing about the success of
+ * whatever the call asked for.
+ */
+__weak int pxe_api_call_weak ( struct i386_all_regs *ix86 __unused ) {
+ return -1;
+}
+
+/**
* SYSLINUX API
*/
static __asmcall void int22 ( struct i386_all_regs *ix86 ) {
diff --git a/src/include/compiler.h b/src/include/compiler.h
index ea81fc8..79557c3 100644
--- a/src/include/compiler.h
+++ b/src/include/compiler.h
@@ -179,41 +179,12 @@ REQUEST_EXPANDED ( CONFIG_SYMBOL );
/** Select file identifier for errno.h (if used) */
#define ERRFILE PREFIX_OBJECT ( ERRFILE_ )
-/**
- * @defgroup weakmacros Macros to manage weak symbol definitions
- *
- * Weak symbols allow one to reference a function in another file
- * without necessarily requiring that file to be linked in. In their
- * native form, the function will be @c NULL if its file is not linked
- * in; these macros provide an inline wrapper that returns an
- * appropriate error indication or default value.
- *
- * @{
- */
#ifndef ASSEMBLY
-/** Mangle @a name into its weakly-referenced implementation */
-#define __weak_impl( name ) _w_ ## name
-
-/**
- * Declare a weak function with inline safety wrapper
- *
- * @v ret Return type of weak function
- * @v name Name of function to expose
- * @v proto Parenthesized list of arguments with types
- * @v args Parenthesized list of argument names
- * @v dfl Value to return if weak function is not available
- */
-#define __weak_decl( ret, name, proto, args, dfl ) \
- ret __weak_impl( name ) proto __attribute__ (( weak )); \
- static inline ret name proto { \
- if ( __weak_impl( name ) ) \
- return __weak_impl( name ) args; \
- return dfl; \
- }
+/** Declare a function as weak (use *before* the definition) */
+#define __weak __attribute__ (( weak ))
#endif
-/** @} */
/** @defgroup dbg Debugging infrastructure
* @{
diff --git a/src/include/gpxe/dhcp.h b/src/include/gpxe/dhcp.h
index ebfe8ed..c747948 100644
--- a/src/include/gpxe/dhcp.h
+++ b/src/include/gpxe/dhcp.h
@@ -630,7 +630,7 @@ extern int start_pxebs ( struct job_interface *job, struct net_device *netdev,
* should look for such a packet and call store_cached_dhcpack() with
* it if it exists.
*/
-__weak_decl ( void, get_cached_dhcpack, ( void ), (), );
+extern void get_cached_dhcpack ( void );
extern void store_cached_dhcpack ( userptr_t data, size_t len );
diff --git a/src/include/gpxe/sec80211.h b/src/include/gpxe/sec80211.h
index 502ebf7..1843af3 100644
--- a/src/include/gpxe/sec80211.h
+++ b/src/include/gpxe/sec80211.h
@@ -27,42 +27,11 @@ FILE_LICENCE ( GPL2_OR_LATER );
/** @file
*
* Definitions for general secured-network routines.
- *
- * Any function in this file which may be referenced by code which is
- * not exclusive to encryption-enabled builds (e.g. sec80211_detect(),
- * which is called by net80211_probe_step() to fill the net80211_wlan
- * structure's security fields) must be declared as a weak symbol,
- * using an inline interface similar to that used for
- * sec80211_detect() below. This prevents secure network support from
- * bloating general builds by any more than a few tiny hooks to call
- * crypto functions when crypto structures are non-NULL.
*/
-int _sec80211_detect ( struct io_buffer *iob,
- enum net80211_security_proto *secprot,
- enum net80211_crypto_alg *crypt )
- __attribute__ (( weak ));
-
-
-/**
- * Inline safety wrapper for _sec80211_detect()
- *
- * @v iob I/O buffer containing beacon frame
- * @ret secprot Security handshaking protocol used by network
- * @ret crypt Cryptosystem used by network
- * @ret rc Return status code
- *
- * This function transparently calls _sec80211_detect() if the file
- * containing it was compiled in, or returns an error indication of
- * @c -ENOTSUP if not.
- */
-static inline int sec80211_detect ( struct io_buffer *iob,
- enum net80211_security_proto *secprot,
- enum net80211_crypto_alg *crypt ) {
- if ( _sec80211_detect )
- return _sec80211_detect ( iob, secprot, crypt );
- return -ENOTSUP;
-}
+int sec80211_detect ( struct io_buffer *iob,
+ enum net80211_security_proto *secprot,
+ enum net80211_crypto_alg *crypt );
int sec80211_detect_ie ( int is_rsn, u8 *start, u8 *end,
enum net80211_security_proto *secprot,
diff --git a/src/include/usr/autoboot.h b/src/include/usr/autoboot.h
index a918020..4ce71ed 100644
--- a/src/include/usr/autoboot.h
+++ b/src/include/usr/autoboot.h
@@ -19,7 +19,6 @@ extern int boot_next_server_and_filename ( struct in_addr next_server,
const char *filename );
extern int boot_root_path ( const char *root_path );
-extern int pxe_menu_boot ( struct net_device *netdev )
- __attribute__ (( weak ));
+extern int pxe_menu_boot ( struct net_device *netdev );
#endif /* _USR_AUTOBOOT_H */
diff --git a/src/net/80211/net80211.c b/src/net/80211/net80211.c
index 40f7ba2..9baaaec 100644
--- a/src/net/80211/net80211.c
+++ b/src/net/80211/net80211.c
@@ -140,6 +140,17 @@ struct net80211_assoc_ctx {
};
/**
+ * Detect secure 802.11 network when security support is not available
+ *
+ * @return -ENOTSUP, always.
+ */
+__weak int sec80211_detect ( struct io_buffer *iob __unused,
+ enum net80211_security_proto *secprot __unused,
+ enum net80211_crypto_alg *crypt __unused ) {
+ return -ENOTSUP;
+}
+
+/**
* @defgroup net80211_netdev Network device interface functions
* @{
*/
diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c
index 5f2d719..8ee4100 100644
--- a/src/net/udp/dhcp.c
+++ b/src/net/udp/dhcp.c
@@ -1410,6 +1410,11 @@ static struct sockaddr dhcp_peer = {
};
/**
+ * Get cached DHCPACK where none exists
+ */
+__weak void get_cached_dhcpack ( void ) {}
+
+/**
* Start DHCP state machine on a network device
*
* @v job Job control interface
diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c
index 2fa10e6..d76751b 100644
--- a/src/usr/autoboot.c
+++ b/src/usr/autoboot.c
@@ -43,6 +43,13 @@ FILE_LICENCE ( GPL2_OR_LATER );
int shutdown_exit_flags = 0;
/**
+ * Perform PXE menu boot when PXE stack is not available
+ */
+__weak int pxe_menu_boot ( struct net_device *netdev __unused ) {
+ return -ENOTSUP;
+}
+
+/**
* Identify the boot network device
*
* @ret netdev Boot network device
@@ -155,7 +162,7 @@ static int netboot ( struct net_device *netdev ) {
buf, sizeof ( buf ) );
pxe_discovery_control =
fetch_uintz_setting ( NULL, &pxe_discovery_control_setting );
- if ( ( strcmp ( buf, "PXEClient" ) == 0 ) && pxe_menu_boot != NULL &&
+ if ( ( strcmp ( buf, "PXEClient" ) == 0 ) &&
setting_exists ( NULL, &pxe_boot_menu_setting ) &&
( ! ( ( pxe_discovery_control & PXEBS_SKIP ) &&
setting_exists ( NULL, &filename_setting ) ) ) ) {
------
commit 8820d4cc4f6b6712e5f61e0ba7ad4f4092231faf
Author: Joshua Oreman <oremanj at rwcr.net>
Date: Wed May 26 14:22:03 2010 -0700
Committer: Joshua Oreman <oremanj at rwcr.net>
[dhcp] Don't consider invalid offers to be duplicates
This fixes a regression in BOOTP support; since BOOTP requests often have
the `siaddr' field set to 0.0.0.0, they would be considered duplicates
of the first zeroed-out offer slot.
Signed-off-by: Joshua Oreman <oremanj at rwcr.net>
---
src/net/udp/dhcp.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c
index fa09741..5f2d719 100644
--- a/src/net/udp/dhcp.c
+++ b/src/net/udp/dhcp.c
@@ -417,13 +417,13 @@ static void dhcp_rx_offer ( struct dhcp_session *dhcp,
/* Enqueue an offer to be filled in */
for ( i = 0 ; i < DHCP_MAX_OFFERS ; i++ ) {
+ if ( ! dhcp->offers[i].valid )
+ break;
+
if ( dhcp->offers[i].server.s_addr == server_id.s_addr ) {
DBGC ( dhcp, " dup\n" );
return;
}
-
- if ( ! dhcp->offers[i].valid )
- break;
}
if ( i == DHCP_MAX_OFFERS ) {
DBGC ( dhcp, " dropped\n" );
------
commit 2991938c2e535ad5e61b63f90afd0060a8f4d444
Author: Piotr JaroszyÅski <p.jaroszynski at gmail.com>
Date: Tue Mar 30 15:33:20 2010 +0200
Committer: Joshua Oreman <oremanj at rwcr.net>
[compiler] Fix 64bit compile time errors
Apart from format specifier fixes there are two changes in proper code:
- Change type of regs in skge_hw to unsigned long
- Cast result of sizeof in myri10ge to uint32_t
Both don't change anything for i386 and should be fine on x86_64.
Signed-off-by: Piotr JaroszyÅski <p.jaroszynski at gmail.com>
Signed-off-by: Joshua Oreman <oremanj at rwcr.net>
---
src/drivers/net/ath5k/ath5k.c | 4 ++--
src/drivers/net/eepro100.c | 2 +-
src/drivers/net/myri10ge.c | 4 ++--
src/drivers/net/skge.c | 6 +++---
src/drivers/net/skge.h | 2 +-
src/net/80211/wpa.c | 6 +++---
6 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/drivers/net/ath5k/ath5k.c b/src/drivers/net/ath5k/ath5k.c
index 37defce..108c0ac 100644
--- a/src/drivers/net/ath5k/ath5k.c
+++ b/src/drivers/net/ath5k/ath5k.c
@@ -843,7 +843,7 @@ ath5k_rxbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
if (ah->ah_setup_rx_desc(ah, ds,
iob_tailroom(iob), /* buffer size */
0) != 0) {
- DBG("ath5k: error setting up RX descriptor for %d bytes\n", iob_tailroom(iob));
+ DBG("ath5k: error setting up RX descriptor for %zd bytes\n", iob_tailroom(iob));
return -EINVAL;
}
@@ -1293,7 +1293,7 @@ ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq)
iob = bf->iob;
bf->iob = NULL;
- DBG2("ath5k: tx %d bytes complete, %d retries\n",
+ DBG2("ath5k: tx %zd bytes complete, %d retries\n",
iob_len(iob), ts.ts_retry[0]);
net80211_tx_complete(sc->dev, iob, ts.ts_retry[0],
diff --git a/src/drivers/net/eepro100.c b/src/drivers/net/eepro100.c
index 3ad45bf..028e98d 100644
--- a/src/drivers/net/eepro100.c
+++ b/src/drivers/net/eepro100.c
@@ -448,7 +448,7 @@ static int ifec_net_transmit ( struct net_device *netdev,
return -ENOBUFS;
}
- DBG2 ( "transmitting packet (%d bytes). status = %hX, cmd=%hX\n",
+ DBG2 ( "transmitting packet (%zd bytes). status = %hX, cmd=%hX\n",
iob_len ( iobuf ), tcb->status, inw ( ioaddr + SCBCmd ) );
tcb->command = CmdSuspend | CmdTx | CmdTxFlex;
diff --git a/src/drivers/net/myri10ge.c b/src/drivers/net/myri10ge.c
index ac2e124..353158b 100644
--- a/src/drivers/net/myri10ge.c
+++ b/src/drivers/net/myri10ge.c
@@ -723,7 +723,7 @@ static int myri10ge_net_open ( struct net_device *netdev )
/* Set the interrupt queue size. */
- data[0] = ( sizeof ( priv->dma->receive_completion )
+ data[0] = ( (uint32_t)( sizeof ( priv->dma->receive_completion ) )
| MXGEFW_CMD_SET_INTRQ_SIZE_FLAG_NO_STRICT_SIZE_CHECK );
TRY ( CMD_SET_ , INTRQ_SIZE , );
@@ -973,7 +973,7 @@ static int myri10ge_net_transmit ( struct net_device *netdev,
return -ENOBUFS;
}
- DBG2 ( "TX %p+%d ", iobuf->data, iob_len ( iobuf ) );
+ DBG2 ( "TX %p+%zd ", iobuf->data, iob_len ( iobuf ) );
DBG2_HD ( iobuf->data, 14 );
/* Record the packet being transmitted, so we can later report
diff --git a/src/drivers/net/skge.c b/src/drivers/net/skge.c
index afe8273..baa9493 100755
--- a/src/drivers/net/skge.c
+++ b/src/drivers/net/skge.c
@@ -1983,13 +1983,13 @@ static void skge_rx_refill(struct net_device *dev)
if (iob || (control & BMU_OWN))
continue;
- DBG2("refilling rx desc %d: ", (ring->to_clean - ring->start));
+ DBG2("refilling rx desc %zd: ", (ring->to_clean - ring->start));
iob = alloc_iob(RX_BUF_SIZE);
if (iob) {
skge_rx_setup(skge, e, iob, RX_BUF_SIZE);
} else {
- DBG("descr %d: alloc_iob() failed\n",
+ DBG("descr %zd: alloc_iob() failed\n",
(ring->to_clean - ring->start));
/* We pass the descriptor to the NIC even if the
* allocation failed. The card will stop as soon as it
@@ -2354,7 +2354,7 @@ static int skge_probe(struct pci_device *pdev,
hw->pdev = pdev;
- hw->regs = (u32)ioremap(pci_bar_start(pdev, PCI_BASE_ADDRESS_0),
+ hw->regs = (unsigned long)ioremap(pci_bar_start(pdev, PCI_BASE_ADDRESS_0),
SKGE_REG_SIZE);
if (!hw->regs) {
DBG(PFX "cannot map device registers\n");
diff --git a/src/drivers/net/skge.h b/src/drivers/net/skge.h
index 6b08daf..60d8a77 100755
--- a/src/drivers/net/skge.h
+++ b/src/drivers/net/skge.h
@@ -2461,7 +2461,7 @@ struct skge_ring {
struct skge_hw {
- u32 regs;
+ unsigned long regs;
struct pci_device *pdev;
u32 intr_mask;
struct net_device *dev[2];
diff --git a/src/net/80211/wpa.c b/src/net/80211/wpa.c
index 2d74b85..94364b0 100644
--- a/src/net/80211/wpa.c
+++ b/src/net/80211/wpa.c
@@ -383,7 +383,7 @@ static int wpa_maybe_install_gtk ( struct wpa_common_ctx *ctx,
return -ENOENT;
if ( ie->len - 6u > sizeof ( ctx->gtk.tk ) ) {
- DBGC ( ctx, "WPA %p: GTK KDE is too long (%d bytes, max %d)\n",
+ DBGC ( ctx, "WPA %p: GTK KDE is too long (%d bytes, max %zd)\n",
ctx, ie->len - 4, sizeof ( ctx->gtk.tk ) );
return -EINVAL;
}
@@ -737,7 +737,7 @@ static int wpa_handle_1_of_2 ( struct wpa_common_ctx *ctx,
return rc; /* non-fatal */
}
if ( pkt->datalen > sizeof ( ctx->gtk.tk ) ) {
- DBGC ( ctx, "WPA %p: too much GTK data (%d > %d)\n",
+ DBGC ( ctx, "WPA %p: too much GTK data (%d > %zd)\n",
ctx, pkt->datalen, sizeof ( ctx->gtk.tk ) );
return wpa_fail ( ctx, -EINVAL );
}
@@ -813,7 +813,7 @@ static int eapol_key_rx ( struct io_buffer *iob, struct net_device *netdev,
}
if ( ( void * ) ( pkt + 1 ) + ntohs ( pkt->datalen ) > iob->tail ) {
- DBGC ( ctx, "WPA %p: packet truncated (has %d extra bytes, "
+ DBGC ( ctx, "WPA %p: packet truncated (has %zd extra bytes, "
"states %d)\n", ctx, iob->tail - ( void * ) ( pkt + 1 ),
ntohs ( pkt->datalen ) );
rc = -EINVAL;
-----------------------------------------------------------------------
--
Main gPXE repository
More information about the gPXE-commits
mailing list