From: Roy Marples Date: Tue, 28 Mar 2017 21:08:59 +0000 (+0100) Subject: Remove the gateway and nogateway options. X-Git-Tag: v7.0.0-beta1~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6456fc2789546358f6248f1ed8580dae5611ddfa;p=thirdparty%2Fdhcpcd.git Remove the gateway and nogateway options. These can be controlled via the nooption directives instead. --- diff --git a/src/dhcpcd.8.in b/src/dhcpcd.8.in index 1af87734..5dff549b 100644 --- a/src/dhcpcd.8.in +++ b/src/dhcpcd.8.in @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 24, 2017 +.Dd March 28, 2017 .Dt DHCPCD 8 .Os .Sh NAME @@ -597,8 +597,6 @@ So to stop .Nm from touching your DNS settings you would do:- .D1 dhcpcd -C resolv.conf eth0 -.It Fl G , Fl Fl nogateway -Don't set any default routes. .It Fl H , Fl Fl xidhwaddr Use the last four bytes of the hardware address as the DHCP xid instead of a randomly generated number. diff --git a/src/dhcpcd.conf.5.in b/src/dhcpcd.conf.5.in index 7e3db0ff..97d2f811 100644 --- a/src/dhcpcd.conf.5.in +++ b/src/dhcpcd.conf.5.in @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 24, 2017 +.Dd March 28, 2017 .Dt DHCPCD.CONF 5 .Os .Sh NAME @@ -445,10 +445,6 @@ This is only useful when allowing IPv4LL. .It Ic nodhcp6 Don't start DHCPv6 or listen to DHCPv6 messages. Normally DHCPv6 is started by a RA instruction or configuration. -.It Ic nogateway -Don't install any default routes. -.It Ic gateway -Install a default route if available (default). .It Ic nohook Ar script Don't run this hook script. Matches full name, or prefixed with 2 numbers optionally ending with diff --git a/src/if-options.c b/src/if-options.c index 7f171486..dd0738f9 100644 --- a/src/if-options.c +++ b/src/if-options.c @@ -93,7 +93,7 @@ #define O_IPV6 O_BASE + 33 #define O_CONTROLGRP O_BASE + 34 #define O_SLAAC O_BASE + 35 -#define O_GATEWAY O_BASE + 36 +// unused O_BASE + 36 #define O_NOUP O_BASE + 37 #define O_IPV6RA_AUTOCONF O_BASE + 38 #define O_IPV6RA_NOAUTOCONF O_BASE + 39 @@ -195,7 +195,6 @@ const struct option cf_options[] = { {"nodhcp6", no_argument, NULL, O_NODHCP6}, {"controlgroup", required_argument, NULL, O_CONTROLGRP}, {"slaac", required_argument, NULL, O_SLAAC}, - {"gateway", no_argument, NULL, O_GATEWAY}, {"reject", required_argument, NULL, O_REJECT}, {"bootp", no_argument, NULL, O_BOOTP}, {"nodelay", no_argument, NULL, O_NODELAY}, @@ -968,9 +967,6 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, return -1; } break; - case 'G': - ifo->options &= ~DHCPCD_GATEWAY; - break; case 'H': ifo->options |= DHCPCD_XID_HWADDR; break; @@ -2082,9 +2078,6 @@ err_sla: ctx->control_group = grp->gr_gid; #endif break; - case O_GATEWAY: - ifo->options |= DHCPCD_GATEWAY; - break; case O_NOUP: ifo->options &= ~DHCPCD_IF_UP; break; @@ -2271,8 +2264,7 @@ read_config(struct dhcpcd_ctx *ctx, ifo->options |= DHCPCD_DEV; #endif #ifdef INET - ifo->options |= DHCPCD_IPV4 | DHCPCD_DHCP | DHCPCD_IPV4LL; - ifo->options |= DHCPCD_GATEWAY | DHCPCD_ARP; + ifo->options |= DHCPCD_IPV4 | DHCPCD_ARP | DHCPCD_DHCP | DHCPCD_IPV4LL; #endif #ifdef INET6 ifo->options |= DHCPCD_IPV6 | DHCPCD_IPV6RS; diff --git a/src/if-options.h b/src/if-options.h index be1325b7..81f727b0 100644 --- a/src/if-options.h +++ b/src/if-options.h @@ -43,7 +43,7 @@ /* Don't set any optional arguments here so we retain POSIX * compatibility with getopt */ #define IF_OPTS "146bc:de:f:gh:i:kl:m:no:pqr:s:t:u:v:wxy:z:" \ - "ABC:DEF:GHI:JKLMNO:PQ:S:TUVW:X:Z:" + "ABC:DEF:HI:JKLMNO:PQ:S:TUVW:X:Z:" #define NOERR_IF_OPTS ":" IF_OPTS #define DEFAULT_TIMEOUT 30 @@ -61,7 +61,7 @@ #define DHCPCD_ARP (1ULL << 0) #define DHCPCD_RELEASE (1ULL << 1) #define DHCPCD_DOMAIN (1ULL << 2) -#define DHCPCD_GATEWAY (1ULL << 3) +// unused (1ULL << 3) #define DHCPCD_STATIC (1ULL << 4) #define DHCPCD_DEBUG (1ULL << 5) #define DHCPCD_LASTLEASE (1ULL << 7) diff --git a/src/ipv4.c b/src/ipv4.c index e6d7c559..aa1f20c7 100644 --- a/src/ipv4.c +++ b/src/ipv4.c @@ -299,7 +299,6 @@ inet_dhcproutes(struct rt_head *routes, struct interface *ifp) /* If configured, Install a gateway to the desintion * for P2P interfaces. */ if (ifp->flags & IFF_POINTOPOINT && - ifp->options->options & DHCPCD_GATEWAY && has_option_mask(ifp->options->dstmask, DHO_ROUTER)) { if ((rt = rt_new(ifp)) == NULL) @@ -432,10 +431,8 @@ inet_getroutes(struct dhcpcd_ctx *ctx, struct rt_head *routes) return false; if (ipv4ll_subnetroute(routes, ifp) == -1) return false; - if (ifp->options->options & DHCPCD_GATEWAY) { - if (inet_routerhostroute(routes, ifp) == -1) - return false; - } + if (inet_routerhostroute(routes, ifp) == -1) + return false; } /* If there is no default route, see if we can use an IPv4LL one. */ @@ -445,7 +442,6 @@ inet_getroutes(struct dhcpcd_ctx *ctx, struct rt_head *routes) if (!have_default) { TAILQ_FOREACH(ifp, ctx->ifaces, next) { if (ifp->active && - ifp->options->options & DHCPCD_GATEWAY && ipv4ll_defaultroute(routes, ifp) == 1) break; } diff --git a/src/route.c b/src/route.c index c91c224d..d3a51d69 100644 --- a/src/route.c +++ b/src/route.c @@ -277,19 +277,10 @@ rt_add(struct rt *nrt, struct rt *ort) { struct dhcpcd_ctx *ctx; bool change; - unsigned long long options; assert(nrt != NULL); ctx = nrt->rt_ifp->ctx; - /* Don't set default routes if not asked to */ - options = nrt->rt_ifp->options == NULL ? - ctx->options : nrt->rt_ifp->options->options; - if (!(options & DHCPCD_GATEWAY) && - sa_is_unspecified(&nrt->rt_dest) && - sa_is_unspecified(&nrt->rt_netmask)) - return false; - rt_desc(ort == NULL ? "adding" : "changing", nrt); change = false;