|
@@ -141,12 +141,20 @@ void del_ipv4_address ( struct net_device *netdev ) {
|
141
|
141
|
* @v dest Final destination address
|
142
|
142
|
* @ret dest Next hop destination address
|
143
|
143
|
* @ret miniroute Routing table entry to use, or NULL if no route
|
|
144
|
+ *
|
|
145
|
+ * If the route requires use of a gateway, the next hop destination
|
|
146
|
+ * address will be overwritten with the gateway address.
|
144
|
147
|
*/
|
145
|
148
|
static struct ipv4_miniroute * ipv4_route ( struct in_addr *dest ) {
|
146
|
149
|
struct ipv4_miniroute *miniroute;
|
147
|
150
|
int local;
|
148
|
151
|
int has_gw;
|
149
|
152
|
|
|
153
|
+ /* Never attempt to route the broadcast address */
|
|
154
|
+ if ( dest->s_addr == INADDR_BROADCAST )
|
|
155
|
+ return NULL;
|
|
156
|
+
|
|
157
|
+ /* Find first usable route in routing table */
|
150
|
158
|
list_for_each_entry ( miniroute, &ipv4_miniroutes, list ) {
|
151
|
159
|
local = ( ( ( dest->s_addr ^ miniroute->address.s_addr )
|
152
|
160
|
& miniroute->netmask.s_addr ) == 0 );
|