|
| 1 | +From 6620d4778fe36c89ce2e95d6932338cefc90df7d Mon Sep 17 00:00:00 2001 |
| 2 | +From: Joe LeVeque < [email protected]> |
| 3 | +Date: Fri, 17 May 2019 21:53:52 +0000 |
| 4 | +Subject: [PATCH 2/3] Bugfix: Ensure HAVE_SO_BINDTODEVICE has a chance to be |
| 5 | + defined before it is referenced |
| 6 | + |
| 7 | +--- |
| 8 | + includes/osdep.h | 239 ++++++++++++++++++++++++----------------------- |
| 9 | + 1 file changed, 120 insertions(+), 119 deletions(-) |
| 10 | + |
| 11 | +diff --git a/includes/osdep.h b/includes/osdep.h |
| 12 | +index cfae90b..f07c43c 100644 |
| 13 | +--- a/includes/osdep.h |
| 14 | ++++ b/includes/osdep.h |
| 15 | +@@ -48,37 +48,6 @@ |
| 16 | + #define BYTE_ORDER DHCP_BYTE_ORDER |
| 17 | + #endif /* BYTE_ORDER */ |
| 18 | + |
| 19 | +-/* Porting:: |
| 20 | +- |
| 21 | +- If you add a new network API, you must add a check for it below: */ |
| 22 | +- |
| 23 | +-#if !defined (USE_SOCKETS) && \ |
| 24 | +- !defined (USE_SOCKET_SEND) && \ |
| 25 | +- !defined (USE_SOCKET_RECEIVE) && \ |
| 26 | +- !defined (USE_RAW_SOCKETS) && \ |
| 27 | +- !defined (USE_RAW_SEND) && \ |
| 28 | +- !defined (USE_SOCKET_RECEIVE) && \ |
| 29 | +- !defined (USE_BPF) && \ |
| 30 | +- !defined (USE_BPF_SEND) && \ |
| 31 | +- !defined (USE_BPF_RECEIVE) && \ |
| 32 | +- !defined (USE_LPF) && \ |
| 33 | +- !defined (USE_LPF_SEND) && \ |
| 34 | +- !defined (USE_LPF_RECEIVE) && \ |
| 35 | +- !defined (USE_NIT) && \ |
| 36 | +- !defined (USE_NIT_SEND) && \ |
| 37 | +- !defined (USE_NIT_RECEIVE) && \ |
| 38 | +- !defined (USE_DLPI_SEND) && \ |
| 39 | +- !defined (USE_DLPI_RECEIVE) |
| 40 | +-/* Determine default socket API to USE. */ |
| 41 | +-# if defined(HAVE_BPF) |
| 42 | +-# define USE_BPF 1 |
| 43 | +-# elif defined(HAVE_LPF) |
| 44 | +-# define USE_LPF 1 |
| 45 | +-# elif defined(HAVE_DLPI) |
| 46 | +-# define USE_DLPI 1 |
| 47 | +-# endif |
| 48 | +-#endif |
| 49 | +- |
| 50 | + #if !defined (TIME_MAX) |
| 51 | + # define TIME_MAX 2147483647 |
| 52 | + #endif |
| 53 | +@@ -91,94 +60,6 @@ |
| 54 | + # define vsnprintf isc_print_vsnprintf |
| 55 | + #endif |
| 56 | + |
| 57 | +-/* Porting:: |
| 58 | +- |
| 59 | +- If you add a new network API, and have it set up so that it can be |
| 60 | +- used for sending or receiving, but doesn't have to be used for both, |
| 61 | +- then set up an ifdef like the ones below: */ |
| 62 | +- |
| 63 | +-#ifdef USE_SOCKETS |
| 64 | +-# define USE_SOCKET_SEND |
| 65 | +-# define USE_SOCKET_RECEIVE |
| 66 | +-# if defined(HAVE_DLPI) && !defined(sun) && !defined(USE_V4_PKTINFO) |
| 67 | +-# define USE_DLPI_HWADDR |
| 68 | +-# elif defined(HAVE_LPF) |
| 69 | +-# define USE_LPF_HWADDR |
| 70 | +-# elif defined(HAVE_BPF) |
| 71 | +-# define USE_BPF_HWADDR |
| 72 | +-# endif |
| 73 | +-#endif |
| 74 | +- |
| 75 | +-#ifdef USE_RAW_SOCKETS |
| 76 | +-# define USE_RAW_SEND |
| 77 | +-# define USE_SOCKET_RECEIVE |
| 78 | +-#endif |
| 79 | +- |
| 80 | +-#ifdef USE_BPF |
| 81 | +-# define USE_BPF_SEND |
| 82 | +-# define USE_BPF_RECEIVE |
| 83 | +-#endif |
| 84 | +- |
| 85 | +-#ifdef USE_LPF |
| 86 | +-# define USE_LPF_SEND |
| 87 | +-# define USE_LPF_RECEIVE |
| 88 | +-#endif |
| 89 | +- |
| 90 | +-#ifdef USE_NIT |
| 91 | +-# define USE_NIT_SEND |
| 92 | +-# define USE_NIT_RECEIVE |
| 93 | +-#endif |
| 94 | +- |
| 95 | +-#ifdef USE_DLPI |
| 96 | +-# define USE_DLPI_SEND |
| 97 | +-# define USE_DLPI_RECEIVE |
| 98 | +-#endif |
| 99 | +- |
| 100 | +-#ifdef USE_UPF |
| 101 | +-# define USE_UPF_SEND |
| 102 | +-# define USE_UPF_RECEIVE |
| 103 | +-#endif |
| 104 | +- |
| 105 | +-/* Porting:: |
| 106 | +- |
| 107 | +- If you add support for sending packets directly out an interface, |
| 108 | +- and your support does not do ARP or routing, you must use a fallback |
| 109 | +- mechanism to deal with packets that need to be sent to routers. |
| 110 | +- Currently, all low-level packet interfaces use BSD sockets as a |
| 111 | +- fallback. */ |
| 112 | +- |
| 113 | +-#if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \ |
| 114 | +- defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || \ |
| 115 | +- defined (USE_LPF_SEND) || \ |
| 116 | +- (defined (USE_SOCKET_SEND) && defined (HAVE_SO_BINDTODEVICE)) |
| 117 | +-# define USE_SOCKET_FALLBACK |
| 118 | +-# define USE_FALLBACK |
| 119 | +-#endif |
| 120 | +- |
| 121 | +-/* Porting:: |
| 122 | +- |
| 123 | +- If you add support for sending packets directly out an interface |
| 124 | +- and need to be able to assemble packets, add the USE_XXX_SEND |
| 125 | +- definition for your interface to the list tested below. */ |
| 126 | +- |
| 127 | +-#if defined (USE_RAW_SEND) || defined (USE_BPF_SEND) || \ |
| 128 | +- defined (USE_NIT_SEND) || defined (USE_UPF_SEND) || \ |
| 129 | +- defined (USE_DLPI_SEND) || defined (USE_LPF_SEND) |
| 130 | +-# define PACKET_ASSEMBLY |
| 131 | +-#endif |
| 132 | +- |
| 133 | +-/* Porting:: |
| 134 | +- |
| 135 | +- If you add support for receiving packets directly from an interface |
| 136 | +- and need to be able to decode raw packets, add the USE_XXX_RECEIVE |
| 137 | +- definition for your interface to the list tested below. */ |
| 138 | +- |
| 139 | +-#if defined (USE_RAW_RECEIVE) || defined (USE_BPF_SEND) || \ |
| 140 | +- defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \ |
| 141 | +- defined (USE_DLPI_RECEIVE) || defined (USE_LPF_RECEIVE) |
| 142 | +-# define PACKET_DECODING |
| 143 | +-#endif |
| 144 | +- |
| 145 | + /* If we don't have a DLPI packet filter, we have to filter in userland. |
| 146 | + Probably not worth doing, actually. */ |
| 147 | + #if defined (USE_DLPI_RECEIVE) && !defined (USE_DLPI_PFMOD) |
| 148 | +@@ -288,4 +169,124 @@ |
| 149 | + # define STDERR_FILENO 2 |
| 150 | + #endif |
| 151 | + |
| 152 | ++/* Porting:: |
| 153 | ++ |
| 154 | ++ If you add a new network API, you must add a check for it below: */ |
| 155 | ++ |
| 156 | ++#if !defined (USE_SOCKETS) && \ |
| 157 | ++ !defined (USE_SOCKET_SEND) && \ |
| 158 | ++ !defined (USE_SOCKET_RECEIVE) && \ |
| 159 | ++ !defined (USE_RAW_SOCKETS) && \ |
| 160 | ++ !defined (USE_RAW_SEND) && \ |
| 161 | ++ !defined (USE_SOCKET_RECEIVE) && \ |
| 162 | ++ !defined (USE_BPF) && \ |
| 163 | ++ !defined (USE_BPF_SEND) && \ |
| 164 | ++ !defined (USE_BPF_RECEIVE) && \ |
| 165 | ++ !defined (USE_LPF) && \ |
| 166 | ++ !defined (USE_LPF_SEND) && \ |
| 167 | ++ !defined (USE_LPF_RECEIVE) && \ |
| 168 | ++ !defined (USE_NIT) && \ |
| 169 | ++ !defined (USE_NIT_SEND) && \ |
| 170 | ++ !defined (USE_NIT_RECEIVE) && \ |
| 171 | ++ !defined (USE_DLPI_SEND) && \ |
| 172 | ++ !defined (USE_DLPI_RECEIVE) |
| 173 | ++/* Determine default socket API to USE. */ |
| 174 | ++# if defined(HAVE_BPF) |
| 175 | ++# define USE_BPF 1 |
| 176 | ++# elif defined(HAVE_LPF) |
| 177 | ++# define USE_LPF 1 |
| 178 | ++# elif defined(HAVE_DLPI) |
| 179 | ++# define USE_DLPI 1 |
| 180 | ++# endif |
| 181 | ++#endif |
| 182 | ++ |
| 183 | ++/* Porting:: |
| 184 | ++ |
| 185 | ++ If you add a new network API, and have it set up so that it can be |
| 186 | ++ used for sending or receiving, but doesn't have to be used for both, |
| 187 | ++ then set up an ifdef like the ones below: */ |
| 188 | ++ |
| 189 | ++#ifdef USE_SOCKETS |
| 190 | ++# define USE_SOCKET_SEND |
| 191 | ++# define USE_SOCKET_RECEIVE |
| 192 | ++# if defined(HAVE_DLPI) && !defined(sun) && !defined(USE_V4_PKTINFO) |
| 193 | ++# define USE_DLPI_HWADDR |
| 194 | ++# elif defined(HAVE_LPF) |
| 195 | ++# define USE_LPF_HWADDR |
| 196 | ++# elif defined(HAVE_BPF) |
| 197 | ++# define USE_BPF_HWADDR |
| 198 | ++# endif |
| 199 | ++#endif |
| 200 | ++ |
| 201 | ++#ifdef USE_RAW_SOCKETS |
| 202 | ++# define USE_RAW_SEND |
| 203 | ++# define USE_SOCKET_RECEIVE |
| 204 | ++#endif |
| 205 | ++ |
| 206 | ++#ifdef USE_BPF |
| 207 | ++# define USE_BPF_SEND |
| 208 | ++# define USE_BPF_RECEIVE |
| 209 | ++#endif |
| 210 | ++ |
| 211 | ++#ifdef USE_LPF |
| 212 | ++# define USE_LPF_SEND |
| 213 | ++# define USE_LPF_RECEIVE |
| 214 | ++#endif |
| 215 | ++ |
| 216 | ++#ifdef USE_NIT |
| 217 | ++# define USE_NIT_SEND |
| 218 | ++# define USE_NIT_RECEIVE |
| 219 | ++#endif |
| 220 | ++ |
| 221 | ++#ifdef USE_DLPI |
| 222 | ++# define USE_DLPI_SEND |
| 223 | ++# define USE_DLPI_RECEIVE |
| 224 | ++#endif |
| 225 | ++ |
| 226 | ++#ifdef USE_UPF |
| 227 | ++# define USE_UPF_SEND |
| 228 | ++# define USE_UPF_RECEIVE |
| 229 | ++#endif |
| 230 | ++ |
| 231 | ++/* Porting:: |
| 232 | ++ |
| 233 | ++ If you add support for sending packets directly out an interface, |
| 234 | ++ and your support does not do ARP or routing, you must use a fallback |
| 235 | ++ mechanism to deal with packets that need to be sent to routers. |
| 236 | ++ Currently, all low-level packet interfaces use BSD sockets as a |
| 237 | ++ fallback. */ |
| 238 | ++ |
| 239 | ++#if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \ |
| 240 | ++ defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || \ |
| 241 | ++ defined (USE_LPF_SEND) || \ |
| 242 | ++ (defined (USE_SOCKET_SEND) && defined (HAVE_SO_BINDTODEVICE)) |
| 243 | ++# define USE_SOCKET_FALLBACK |
| 244 | ++# define USE_FALLBACK |
| 245 | ++#endif |
| 246 | ++ |
| 247 | ++/* Porting:: |
| 248 | ++ |
| 249 | ++ If you add support for sending packets directly out an interface |
| 250 | ++ and need to be able to assemble packets, add the USE_XXX_SEND |
| 251 | ++ definition for your interface to the list tested below. */ |
| 252 | ++ |
| 253 | ++#if defined (USE_RAW_SEND) || defined (USE_BPF_SEND) || \ |
| 254 | ++ defined (USE_NIT_SEND) || defined (USE_UPF_SEND) || \ |
| 255 | ++ defined (USE_DLPI_SEND) || defined (USE_LPF_SEND) |
| 256 | ++# define PACKET_ASSEMBLY |
| 257 | ++#endif |
| 258 | ++ |
| 259 | ++/* Porting:: |
| 260 | ++ |
| 261 | ++ If you add support for receiving packets directly from an interface |
| 262 | ++ and need to be able to decode raw packets, add the USE_XXX_RECEIVE |
| 263 | ++ definition for your interface to the list tested below. */ |
| 264 | ++ |
| 265 | ++#if defined (USE_RAW_RECEIVE) || defined (USE_BPF_SEND) || \ |
| 266 | ++ defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \ |
| 267 | ++ defined (USE_DLPI_RECEIVE) || defined (USE_LPF_RECEIVE) |
| 268 | ++# define PACKET_DECODING |
| 269 | ++#endif |
| 270 | ++ |
| 271 | ++ |
| 272 | + #endif /* __ISC_DHCP_OSDEP_H__ */ |
| 273 | +-- |
| 274 | +2.17.1 |
| 275 | + |
0 commit comments