|
@@ -600,18 +600,18 @@ static int ipv4_create_routes ( void ) {
|
600
|
600
|
fetch_ipv4_setting ( settings, &ip_setting, &address );
|
601
|
601
|
if ( ! address.s_addr )
|
602
|
602
|
continue;
|
603
|
|
- /* Calculate default netmask */
|
604
|
|
- if ( IN_CLASSA ( ntohl ( address.s_addr ) ) ) {
|
605
|
|
- netmask.s_addr = htonl ( IN_CLASSA_NET );
|
606
|
|
- } else if ( IN_CLASSB ( ntohl ( address.s_addr ) ) ) {
|
607
|
|
- netmask.s_addr = htonl ( IN_CLASSB_NET );
|
608
|
|
- } else if ( IN_CLASSC ( ntohl ( address.s_addr ) ) ) {
|
609
|
|
- netmask.s_addr = htonl ( IN_CLASSC_NET );
|
610
|
|
- } else {
|
611
|
|
- netmask.s_addr = 0;
|
612
|
|
- }
|
613
|
|
- /* Override with subnet mask, if present */
|
|
603
|
+ /* Get subnet mask */
|
614
|
604
|
fetch_ipv4_setting ( settings, &netmask_setting, &netmask );
|
|
605
|
+ /* Calculate default netmask, if necessary */
|
|
606
|
+ if ( ! netmask.s_addr ) {
|
|
607
|
+ if ( IN_CLASSA ( ntohl ( address.s_addr ) ) ) {
|
|
608
|
+ netmask.s_addr = htonl ( IN_CLASSA_NET );
|
|
609
|
+ } else if ( IN_CLASSB ( ntohl ( address.s_addr ) ) ) {
|
|
610
|
+ netmask.s_addr = htonl ( IN_CLASSB_NET );
|
|
611
|
+ } else if ( IN_CLASSC ( ntohl ( address.s_addr ) ) ) {
|
|
612
|
+ netmask.s_addr = htonl ( IN_CLASSC_NET );
|
|
613
|
+ }
|
|
614
|
+ }
|
615
|
615
|
/* Get default gateway, if present */
|
616
|
616
|
fetch_ipv4_setting ( settings, &gateway_setting, &gateway );
|
617
|
617
|
/* Configure route */
|