diff options
author | Michael Brown | 2007-07-03 14:55:45 +0200 |
---|---|---|
committer | Michael Brown | 2007-07-03 14:55:45 +0200 |
commit | 5b52630a9c6e4ef28a38dd8b154f14edf990f284 (patch) | |
tree | eaff8af9e3880ee7f9ebda688896dbcabdee8a7f /src/net/ipv4.c | |
parent | Document TX completion bug. (diff) | |
download | ipxe-5b52630a9c6e4ef28a38dd8b154f14edf990f284.tar.gz ipxe-5b52630a9c6e4ef28a38dd8b154f14edf990f284.tar.xz ipxe-5b52630a9c6e4ef28a38dd8b154f14edf990f284.zip |
Never attempt to route the broadcast address.
Diffstat (limited to 'src/net/ipv4.c')
-rw-r--r-- | src/net/ipv4.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/net/ipv4.c b/src/net/ipv4.c index e1219edb..35341b3d 100644 --- a/src/net/ipv4.c +++ b/src/net/ipv4.c @@ -141,12 +141,20 @@ void del_ipv4_address ( struct net_device *netdev ) { * @v dest Final destination address * @ret dest Next hop destination address * @ret miniroute Routing table entry to use, or NULL if no route + * + * If the route requires use of a gateway, the next hop destination + * address will be overwritten with the gateway address. */ static struct ipv4_miniroute * ipv4_route ( struct in_addr *dest ) { struct ipv4_miniroute *miniroute; int local; int has_gw; + /* Never attempt to route the broadcast address */ + if ( dest->s_addr == INADDR_BROADCAST ) + return NULL; + + /* Find first usable route in routing table */ list_for_each_entry ( miniroute, &ipv4_miniroutes, list ) { local = ( ( ( dest->s_addr ^ miniroute->address.s_addr ) & miniroute->netmask.s_addr ) == 0 ); |