wok view dhcp6/stuff/start-without-ipv6.u @ rev 5223

Add liblinebreak
author Alexander Medvedev <devl547@gmail.com>
date Wed Apr 07 12:52:46 2010 +0000 (2010-04-07)
parents
children
line source
1 --- dhcp-4.1.1b1/common/discover.c
2 +++ dhcp-4.1.1b1/common/discover.c
3 @@ -443,15 +443,17 @@
4 }
6 #ifdef DHCPv6
7 - ifaces->fp6 = fopen("/proc/net/if_inet6", "r");
8 - if (ifaces->fp6 == NULL) {
9 - log_error("Error opening '/proc/net/if_inet6' to "
10 - "list IPv6 interfaces; %m");
11 - close(ifaces->sock);
12 - ifaces->sock = -1;
13 - fclose(ifaces->fp);
14 - ifaces->fp = NULL;
15 - return 0;
16 + if (local_family == AF_INET6) {
17 + ifaces->fp6 = fopen("/proc/net/if_inet6", "r");
18 + if (ifaces->fp6 == NULL) {
19 + log_error("Error opening '/proc/net/if_inet6' to "
20 + "list IPv6 interfaces; %m");
21 + close(ifaces->sock);
22 + ifaces->sock = -1;
23 + fclose(ifaces->fp);
24 + ifaces->fp = NULL;
25 + return 0;
26 + }
27 }
28 #endif
30 @@ -720,7 +722,8 @@
31 }
32 #ifdef DHCPv6
33 if (!(*err)) {
34 - return next_iface6(info, err, ifaces);
35 + if (local_family == AF_INET6)
36 + return next_iface6(info, err, ifaces);
37 }
38 #endif
39 return 0;
40 @@ -736,7 +739,8 @@
41 close(ifaces->sock);
42 ifaces->sock = -1;
43 #ifdef DHCPv6
44 - fclose(ifaces->fp6);
45 + if (local_family == AF_INET6)
46 + fclose(ifaces->fp6);
47 ifaces->fp6 = NULL;
48 #endif
49 }