From: Roy Marples Date: Mon, 12 Sep 2016 16:03:19 +0000 (+0000) Subject: Solaris allows a route per gateway as well. X-Git-Tag: v6.11.4~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14602bba9626c69b21622474b1b937ff4bbeb413;p=thirdparty%2Fdhcpcd.git Solaris allows a route per gateway as well. --- diff --git a/if.h b/if.h index b38b43ac..670c8b8a 100644 --- a/if.h +++ b/if.h @@ -43,6 +43,12 @@ # endif #endif +#if defined(__OpenBSD) || defined (__sun) +# define ROUTE_PER_GATEWAY +/* XXX dhcpcd doesn't really support this yet. + * But that's generally OK if only dhcpcd is managing routes. */ +#endif + /* Some systems have in-built IPv4 DAD. * However, we need them to do DAD at carrier up as well. */ #ifdef IN_IFF_TENTATIVE diff --git a/ipv4.c b/ipv4.c index 98fb2b04..cc80b532 100644 --- a/ipv4.c +++ b/ipv4.c @@ -483,7 +483,7 @@ nc_route(struct rt *ort, struct rt *nrt) /* No route metrics, we need to delete the old route before * adding the new one. */ -#ifdef __OpenBSD__ +#ifdef ROUTE_PER_GATEWAY errno = 0; #endif if (ort) { @@ -492,8 +492,8 @@ nc_route(struct rt *ort, struct rt *nrt) else d_kroute(ort); } -#ifdef __OpenBSD__ - /* OpenBSD allows many routes to the same dest with different gateways. +#ifdef ROUTE_PER_GATEWAY + /* The OS allows many routes to the same dest with different gateways. * dhcpcd does not support this yet, so for the time being just keep on * deleting the route until there is an error. */ if (ort && errno == 0) { diff --git a/ipv6.c b/ipv6.c index eb1dfcc6..61bc3c63 100644 --- a/ipv6.c +++ b/ipv6.c @@ -2285,13 +2285,13 @@ nc_route(struct rt6 *ort, struct rt6 *nrt) /* No route metrics, we need to delete the old route before * adding the new one. */ -#ifdef __OpenBSD__ +#ifdef ROUTE_PER_GATEWAY errno = 0; #endif if (ort && if_route6(RTM_DELETE, ort) == -1 && errno != ESRCH) logger(nrt->iface->ctx, LOG_ERR, "if_route6 (DEL): %m"); -#ifdef __OpenBSD__ - /* OpenBSD allows many routes to the same dest with different gateways. +#ifdef ROUTE_PER_GATEWAY + /* The OS allows many routes to the same dest with different gateways. * dhcpcd does not support this yet, so for the time being just keep on * deleting the route until there is an error. */ if (ort && errno == 0) {