|
@@ -40,7 +40,7 @@ static LIST_HEAD ( frag_buffers );
|
40
|
40
|
* @v netdev Network device
|
41
|
41
|
* @v address IPv4 address
|
42
|
42
|
* @v netmask Subnet mask
|
43
|
|
- * @v gateway Gateway address (or @c INADDR_NONE for no gateway)
|
|
43
|
+ * @v gateway Gateway address (if any)
|
44
|
44
|
* @ret miniroute Routing table entry, or NULL
|
45
|
45
|
*/
|
46
|
46
|
static struct ipv4_miniroute * __malloc
|
|
@@ -50,7 +50,7 @@ add_ipv4_miniroute ( struct net_device *netdev, struct in_addr address,
|
50
|
50
|
|
51
|
51
|
DBG ( "IPv4 add %s", inet_ntoa ( address ) );
|
52
|
52
|
DBG ( "/%s ", inet_ntoa ( netmask ) );
|
53
|
|
- if ( gateway.s_addr != INADDR_NONE )
|
|
53
|
+ if ( gateway.s_addr )
|
54
|
54
|
DBG ( "gw %s ", inet_ntoa ( gateway ) );
|
55
|
55
|
DBG ( "via %s\n", netdev->name );
|
56
|
56
|
|
|
@@ -70,7 +70,7 @@ add_ipv4_miniroute ( struct net_device *netdev, struct in_addr address,
|
70
|
70
|
/* Add to end of list if we have a gateway, otherwise
|
71
|
71
|
* to start of list.
|
72
|
72
|
*/
|
73
|
|
- if ( gateway.s_addr != INADDR_NONE ) {
|
|
73
|
+ if ( gateway.s_addr ) {
|
74
|
74
|
list_add_tail ( &miniroute->list, &ipv4_miniroutes );
|
75
|
75
|
} else {
|
76
|
76
|
list_add ( &miniroute->list, &ipv4_miniroutes );
|
|
@@ -88,7 +88,7 @@ static void del_ipv4_miniroute ( struct ipv4_miniroute *miniroute ) {
|
88
|
88
|
|
89
|
89
|
DBG ( "IPv4 del %s", inet_ntoa ( miniroute->address ) );
|
90
|
90
|
DBG ( "/%s ", inet_ntoa ( miniroute->netmask ) );
|
91
|
|
- if ( miniroute->gateway.s_addr != INADDR_NONE )
|
|
91
|
+ if ( miniroute->gateway.s_addr )
|
92
|
92
|
DBG ( "gw %s ", inet_ntoa ( miniroute->gateway ) );
|
93
|
93
|
DBG ( "via %s\n", miniroute->netdev->name );
|
94
|
94
|
|
|
@@ -120,7 +120,7 @@ static struct ipv4_miniroute * ipv4_route ( struct in_addr *dest ) {
|
120
|
120
|
list_for_each_entry ( miniroute, &ipv4_miniroutes, list ) {
|
121
|
121
|
local = ( ( ( dest->s_addr ^ miniroute->address.s_addr )
|
122
|
122
|
& miniroute->netmask.s_addr ) == 0 );
|
123
|
|
- has_gw = ( miniroute->gateway.s_addr != INADDR_NONE );
|
|
123
|
+ has_gw = ( miniroute->gateway.s_addr );
|
124
|
124
|
if ( local || has_gw ) {
|
125
|
125
|
if ( ! local )
|
126
|
126
|
*dest = miniroute->gateway;
|
|
@@ -586,7 +586,7 @@ static int ipv4_create_routes ( void ) {
|
586
|
586
|
struct settings *settings;
|
587
|
587
|
struct in_addr address = { 0 };
|
588
|
588
|
struct in_addr netmask = { 0 };
|
589
|
|
- struct in_addr gateway = { INADDR_NONE };
|
|
589
|
+ struct in_addr gateway = { 0 };
|
590
|
590
|
|
591
|
591
|
/* Delete all existing routes */
|
592
|
592
|
list_for_each_entry_safe ( miniroute, tmp, &ipv4_miniroutes, list )
|
|
@@ -613,7 +613,6 @@ static int ipv4_create_routes ( void ) {
|
613
|
613
|
/* Override with subnet mask, if present */
|
614
|
614
|
fetch_ipv4_setting ( settings, &netmask_setting, &netmask );
|
615
|
615
|
/* Get default gateway, if present */
|
616
|
|
- gateway.s_addr = INADDR_NONE;
|
617
|
616
|
fetch_ipv4_setting ( settings, &gateway_setting, &gateway );
|
618
|
617
|
/* Configure route */
|
619
|
618
|
miniroute = add_ipv4_miniroute ( netdev, address,
|