comparison src/if-options.c @ 5535:a0d828e25482 draft

Add --noconfigure option With this set dhcpcd will not configure anything on the host. The expectation is that a 3rd party script will instead.
author Roy Marples <roy@marples.name>
date Wed, 04 Nov 2020 14:18:48 +0000
parents e6620d8e18bb
children 08426e8a98a7
comparison
equal deleted inserted replaced
5534:605f7f9a20c0 5535:a0d828e25482
163 {"noup", no_argument, NULL, O_NOUP}, 163 {"noup", no_argument, NULL, O_NOUP},
164 {"lastleaseextend", no_argument, NULL, O_LASTLEASE_EXTEND}, 164 {"lastleaseextend", no_argument, NULL, O_LASTLEASE_EXTEND},
165 {"inactive", no_argument, NULL, O_INACTIVE}, 165 {"inactive", no_argument, NULL, O_INACTIVE},
166 {"mudurl", required_argument, NULL, O_MUDURL}, 166 {"mudurl", required_argument, NULL, O_MUDURL},
167 {"link_rcvbuf", required_argument, NULL, O_LINK_RCVBUF}, 167 {"link_rcvbuf", required_argument, NULL, O_LINK_RCVBUF},
168 {"configure", no_argument, NULL, O_CONFIGURE},
169 {"noconfigure", no_argument, NULL, O_NOCONFIGURE},
168 {NULL, 0, NULL, '\0'} 170 {NULL, 0, NULL, '\0'}
169 }; 171 };
170 172
171 static char * 173 static char *
172 add_environ(char ***array, const char *value, int uniq) 174 add_environ(char ***array, const char *value, int uniq)
2242 logerrx("failed to convert link_rcvbuf %s", arg); 2244 logerrx("failed to convert link_rcvbuf %s", arg);
2243 return -1; 2245 return -1;
2244 } 2246 }
2245 #endif 2247 #endif
2246 break; 2248 break;
2249 case O_CONFIGURE:
2250 ifo->options |= DHCPCD_CONFIGURE;
2251 break;
2252 case O_NOCONFIGURE:
2253 ifo->options &= ~DHCPCD_CONFIGURE;
2254 break;
2247 default: 2255 default:
2248 return 0; 2256 return 0;
2249 } 2257 }
2250 2258
2251 return 1; 2259 return 1;
2361 2369
2362 /* Seed our default options */ 2370 /* Seed our default options */
2363 if ((ifo = default_config(ctx)) == NULL) 2371 if ((ifo = default_config(ctx)) == NULL)
2364 return NULL; 2372 return NULL;
2365 if (default_options == 0) { 2373 if (default_options == 0) {
2366 default_options |= DHCPCD_DAEMONISE | DHCPCD_GATEWAY; 2374 default_options |= DHCPCD_DAEMONISE |
2375 DHCPCD_CONFIGURE | DHCPCD_GATEWAY;
2367 #ifdef INET 2376 #ifdef INET
2368 skip = socket(PF_INET, SOCK_DGRAM, 0); 2377 skip = socket(PF_INET, SOCK_DGRAM, 0);
2369 if (skip != -1) { 2378 if (skip != -1) {
2370 close(skip); 2379 close(skip);
2371 default_options |= DHCPCD_IPV4 | DHCPCD_ARP | 2380 default_options |= DHCPCD_IPV4 | DHCPCD_ARP |