1From 2d18d1680a4ea3a0300955675b4e11f596a85a85 Mon Sep 17 00:00:00 2001
2From: David van Moolenbroek <david@minix3.org>
3Date: Fri, 27 Jan 2017 00:10:49 +0000
4Subject: [PATCH 1/4] MINIX 3 only: mark various functions as weak
5
6This patch aims to mark the following functions as weak:
7
8- ip4_route
9- ip6_route
10- ip6_select_source_address
11
12This allows the LWIP service to override the implementation of those
13functions entirely, without requiring the definition of new prototypes
14for example.  Overriding all of these functions is essential for the
15correct operation of the LWIP service, mainly to support more advanced
16features correctly despite missing support for them in lwIP.
17
18If this patch can no longer be applied, or compilation breaks after
19applying this patch--for example, because the service can no longer
20find these functions' prototypes or the prototypes are incorrect--then
21both this patch and the LWIP service will have to be altered in order
22to achieve the same goal of overriding the above three functions.
23---
24 src/core/ipv4/ip4.c | 1 +
25 src/core/ipv6/ip6.c | 2 ++
26 2 files changed, 3 insertions(+)
27
28diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c
29index 2335452..d2b1751 100644
30--- a/src/core/ipv4/ip4.c
31+++ b/src/core/ipv4/ip4.c
32@@ -149,6 +149,7 @@ ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src)
33  * @return the netif on which to send to reach dest
34  */
35 struct netif *
36+__weak
37 ip4_route(const ip4_addr_t *dest)
38 {
39 #if !LWIP_SINGLE_NETIF
40diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c
41index 39e282e..88d998b 100644
42--- a/src/core/ipv6/ip6.c
43+++ b/src/core/ipv6/ip6.c
44@@ -83,6 +83,7 @@
45  * @return the netif on which to send to reach dest
46  */
47 struct netif *
48+__weak
49 ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest)
50 {
51 #if LWIP_SINGLE_NETIF
52@@ -278,6 +279,7 @@ ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest)
53  *         source address is found
54  */
55 const ip_addr_t *
56+__weak
57 ip6_select_source_address(struct netif *netif, const ip6_addr_t *dest)
58 {
59   const ip_addr_t *best_addr;
60--
612.5.2
62
63