1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-02-07 11:49:40 +00:00

Remove compile-time-bomb code (#if CONFDATE > 20180828) and backport patches

fixing crash with tunnel interfaces

Reported by:	pkg-fallout
Sponsored by:	Orange
This commit is contained in:
Olivier Cochard 2018-07-12 08:07:41 +00:00
parent ea20856a41
commit e5770deccc
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=474490
14 changed files with 243 additions and 3 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= frr
PORTVERSION= 4.0
DISTVERSIONPREFIX= frr-
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= net ipv6
PKGNAMESUFFIX= 4

View File

@ -0,0 +1,12 @@
--- lib/linklist.h.orig 2018-07-12 06:56:52 UTC
+++ lib/linklist.h
@@ -84,9 +84,6 @@ extern void *listnode_head(struct list *);
* and remove list_delete_original and the list_delete #define
* Additionally remove list_free entirely
*/
-#if CONFDATE > 20181001
-CPP_NOTICE("list_delete without double pointer is deprecated, please fixup")
-#endif
extern void list_delete_and_null(struct list **);
extern void list_delete_original(struct list *);
#define list_delete(X) list_delete_original((X)) \

View File

@ -0,0 +1,12 @@
--- lib/stream.h.orig 2018-07-12 06:57:53 UTC
+++ lib/stream.h
@@ -123,9 +123,6 @@ struct stream_fifo {
#define STREAM_CONCAT_REMAIN(S1, S2, size) ((size) - (S1)->endp - (S2)->endp)
/* deprecated macros - do not use in new code */
-#if CONFDATE > 20181128
-CPP_NOTICE("lib: time to remove deprecated stream.h macros")
-#endif
#define STREAM_PNT(S) stream_pnt((S))
#define STREAM_REMAIN(S) STREAM_WRITEABLE((S))

View File

@ -0,0 +1,24 @@
--- lib/zclient.h.orig 2018-07-12 06:57:20 UTC
+++ lib/zclient.h
@@ -353,10 +353,6 @@ struct zclient_options {
/* Prototypes of zebra client service functions. */
extern struct zclient *zclient_new(struct thread_master *);
-#if CONFDATE > 20181101
-CPP_NOTICE("zclient_new_notify can take over or zclient_new now");
-#endif
-
extern struct zclient_options zclient_options_default;
extern struct zclient *zclient_new_notify(struct thread_master *m,
@@ -421,10 +417,6 @@ extern struct interface *zebra_interface_vrf_update_re
vrf_id_t *new_vrf_id);
extern void zebra_interface_if_set_value(struct stream *, struct interface *);
extern void zebra_router_id_update_read(struct stream *s, struct prefix *rid);
-
-#if CONFDATE > 20180823
-CPP_NOTICE("zapi_ipv4_route, zapi_ipv6_route, zapi_ipv4_route_ipv6_nexthop as well as the zapi_ipv4 and zapi_ipv6 data structures should be removed now");
-#endif
extern int zapi_ipv4_route(u_char, struct zclient *, struct prefix_ipv4 *,
struct zapi_ipv4 *) __attribute__((deprecated));

View File

@ -0,0 +1,21 @@
--- ospf6d/ospf6_top.c.orig 2018-07-12 06:58:31 UTC
+++ ospf6d/ospf6_top.c
@@ -363,18 +363,12 @@ DEFUN(no_ospf6_router_id,
return CMD_SUCCESS;
}
-#if CONFDATE > 20180828
-CPP_NOTICE("ospf6: `router-id A.B.C.D` deprecated 2017/08/28")
-#endif
ALIAS_HIDDEN(ospf6_router_id,
ospf6_router_id_hdn_cmd,
"router-id A.B.C.D",
"Configure OSPF6 Router-ID\n"
V4NOTATION_STR)
-#if CONFDATE > 20180828
-CPP_NOTICE("ospf6: `no router-id A.B.C.D` deprecated 2017/08/28")
-#endif
ALIAS_HIDDEN(no_ospf6_router_id,
no_ospf6_router_id_hdn_cmd,
"no router-id [A.B.C.D]",

View File

@ -0,0 +1,22 @@
--- ospfd/ospf_vty.c.orig 2018-07-12 06:56:11 UTC
+++ ospfd/ospf_vty.c
@@ -2337,9 +2337,6 @@ DEFUN (no_ospf_timers_lsa_min_arrival,
return CMD_SUCCESS;
}
-#if CONFDATE > 20180708
-CPP_NOTICE("ospf: `timers lsa arrival (0-1000)` deprecated 2017/07/08")
-#endif
ALIAS_HIDDEN (ospf_timers_lsa_min_arrival,
ospf_timers_lsa_arrival_cmd,
"timers lsa arrival (0-1000)",
@@ -2348,9 +2345,6 @@ ALIAS_HIDDEN (ospf_timers_lsa_min_arrival,
"ospf minimum arrival interval delay\n"
"delay (msec) between accepted lsas\n");
-#if CONFDATE > 20180708
-CPP_NOTICE("ospf: `no timers lsa arrival (0-1000)` deprecated 2017/07/08")
-#endif
ALIAS_HIDDEN (no_ospf_timers_lsa_min_arrival,
no_ospf_timers_lsa_arrival_cmd,
"no timers lsa arrival (0-1000)",

View File

@ -0,0 +1,61 @@
--- zebra/connected.c.orig 2018-03-12 01:53:37.000000000 +0100
+++ zebra/connected.c 2018-07-12 09:11:27.490278000 +0200
@@ -486,7 +486,9 @@
/* Add connected IPv6 route to the interface. */
void connected_add_ipv6(struct interface *ifp, int flags, struct in6_addr *addr,
- u_char prefixlen, const char *label)
+ struct in6_addr *broad, uint8_t prefixlen,
+ const char *label)
+
{
struct prefix_ipv6 *p;
struct connected *ifc;
@@ -508,6 +510,19 @@
IPV6_ADDR_COPY(&p->prefix, addr);
p->prefixlen = prefixlen;
ifc->address = (struct prefix *)p;
+ if (broad) {
+ p = prefix_ipv6_new();
+ p->family = AF_INET6;
+ IPV6_ADDR_COPY(&p->prefix, broad);
+ p->prefixlen = prefixlen;
+ ifc->destination = (struct prefix *)p;
+ } else {
+ if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_PEER)) {
+ zlog_warn("warning: %s called for interface %s with peer flag set, but no peer address supplied",
+ __func__, ifp->name);
+ UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER);
+ }
+ }
/* Label of this address. */
if (label)
@@ -527,9 +542,9 @@
}
void connected_delete_ipv6(struct interface *ifp, struct in6_addr *address,
- u_char prefixlen)
+ struct in6_addr *broad, uint8_t prefixlen)
{
- struct prefix p;
+ struct prefix p, d;
struct connected *ifc;
memset(&p, 0, sizeof(struct prefix));
@@ -537,7 +552,14 @@
memcpy(&p.u.prefix6, address, sizeof(struct in6_addr));
p.prefixlen = prefixlen;
- ifc = connected_check(ifp, &p);
+ if (broad) {
+ memset(&d, 0, sizeof(struct prefix));
+ d.family = AF_INET6;
+ IPV6_ADDR_COPY(&d.u.prefix, broad);
+ d.prefixlen = prefixlen;
+ ifc = connected_check_ptp(ifp, &p, &d);
+ } else
+ ifc = connected_check_ptp(ifp, &p, NULL);
connected_delete_helper(ifc, &p);
}

View File

@ -0,0 +1,17 @@
--- zebra/connected.h.orig 2018-03-12 00:53:37 UTC
+++ zebra/connected.h
@@ -42,10 +42,11 @@ extern void connected_up(struct interface *ifp, struct
extern void connected_down(struct interface *ifp, struct connected *ifc);
extern void connected_add_ipv6(struct interface *ifp, int flags,
- struct in6_addr *address, u_char prefixlen,
- const char *label);
+ struct in6_addr *address, struct in6_addr *broad,
+ uint8_t prefixlen, const char *label);
extern void connected_delete_ipv6(struct interface *ifp,
- struct in6_addr *address, u_char prefixlen);
+ struct in6_addr *address,
+ struct in6_addr *broad, uint8_t prefixlen);
extern int connected_is_unnumbered(struct interface *);

View File

@ -0,0 +1,11 @@
--- zebra/if_ioctl.c.orig 2018-03-12 00:53:37 UTC
+++ zebra/if_ioctl.c
@@ -249,7 +249,7 @@ static int if_getaddrs(void)
}
#endif
- connected_add_ipv6(ifp, flags, &addr->sin6_addr,
+ connected_add_ipv6(ifp, flags, &addr->sin6_addr, NULL,
prefixlen, NULL);
}
}

View File

@ -0,0 +1,11 @@
--- zebra/if_ioctl_solaris.c.orig 2018-03-12 00:53:37 UTC
+++ zebra/if_ioctl_solaris.c
@@ -315,7 +315,7 @@ static int if_get_addr(struct interface *ifp, struct s
connected_add_ipv4(ifp, flags, &SIN(addr)->sin_addr, prefixlen,
(struct in_addr *)dest_pnt, label);
else if (af == AF_INET6)
- connected_add_ipv6(ifp, flags, &SIN6(addr)->sin6_addr,
+ connected_add_ipv6(ifp, flags, &SIN6(addr)->sin6_addr, NULL,
prefixlen, label);
return 0;

View File

@ -0,0 +1,14 @@
--- zebra/if_netlink.c.orig 2018-03-12 00:53:37 UTC
+++ zebra/if_netlink.c
@@ -985,9 +985,11 @@ int netlink_interface_addr(struct sockaddr_nl *snl, st
& (IFA_F_DADFAILED | IFA_F_TENTATIVE)))
connected_add_ipv6(ifp, flags,
(struct in6_addr *)addr,
+ (struct in6_addr *)broad,
ifa->ifa_prefixlen, label);
} else
connected_delete_ipv6(ifp, (struct in6_addr *)addr,
+ (struct in6_addr *)broad,
ifa->ifa_prefixlen);
}

View File

@ -0,0 +1,20 @@
--- zebra/ioctl.c.orig 2018-03-12 00:53:37 UTC
+++ zebra/ioctl.c
@@ -395,10 +395,13 @@ void if_get_flags(struct interface *ifp)
strncpy(ifmr.ifm_name, ifp->name, IFNAMSIZ);
/* Seems not all interfaces implement this ioctl */
- if (if_ioctl(SIOCGIFMEDIA, (caddr_t)&ifmr) < 0)
- zlog_err("if_ioctl(SIOCGIFMEDIA) failed: %s",
- safe_strerror(errno));
- else if (ifmr.ifm_status & IFM_AVALID) /* Link state is valid */
+ if (if_ioctl(SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
+ /* Ignore EINVAL to avoid being too verbose */
+ if (errno != EINVAL)
+ zlog_err("if_ioctl(SIOCGIFMEDIA) failed: %s",
+ safe_strerror(errno));
+ } else if (ifmr.ifm_status
+ & IFM_AVALID) /* Link state is valid */
{
if (ifmr.ifm_status & IFM_ACTIVE)
SET_FLAG(ifreq.ifr_flags, IFF_RUNNING);

View File

@ -0,0 +1,15 @@
--- zebra/kernel_socket.c.orig 2018-03-12 00:53:37 UTC
+++ zebra/kernel_socket.c
@@ -771,10 +771,11 @@ int ifam_read(struct ifa_msghdr *ifam)
if (ifam->ifam_type == RTM_NEWADDR)
connected_add_ipv6(ifp, flags, &addr.sin6.sin6_addr,
+ NULL,
ip6_masklen(mask.sin6.sin6_addr),
(isalias ? ifname : NULL));
else
- connected_delete_ipv6(ifp, &addr.sin6.sin6_addr,
+ connected_delete_ipv6(ifp, &addr.sin6.sin6_addr, NULL,
ip6_masklen(mask.sin6.sin6_addr));
break;
default:

View File

@ -4,5 +4,5 @@ messages like:
To prevent such message kern.ipc.maxsockbuf can be increased:
sysctl kern.ipc.maxsockbuf=16777216
Error messages like "if_ioctl(SIOCGIFMEDIA) failed: Invalid argument" and
crashs with tun,gre or gif interfaces are under investigation.
Error messages like "if_ioctl(SIOCGIFMEDIA) failed: Invalid argument" are
under investigation.