Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | From d527a0b7b63e43263384540b5525714484bb089f Mon Sep 17 00:00:00 2001 |
| 2 | From: Mingli Yu <Mingli.Yu@windriver.com> |
| 3 | Date: Mon, 3 Sep 2018 14:40:56 +0800 |
| 4 | Subject: [PATCH] libfdcore/sctp.c: update the old sctp api check |
| 5 | |
| 6 | The initial sctp api check for freediameter as below: |
| 7 | === |
| 8 | commit d3c5e991cb532ea09684d69fb4d0d58e9bc39a0c |
| 9 | Author: Sebastien Decugis <sdecugis@freediameter.net> |
| 10 | Date: Mon Jun 3 12:05:37 2013 +0800 |
| 11 | |
| 12 | Add some compliancy to RFC6458. Not tested however as Ubuntu does not support this yet |
| 13 | |
| 14 | [snip] |
| 15 | +/* Use old draft-ietf-tsvwg-sctpsocket-17 API ? If not defined, RFC6458 API will be used */ |
| 16 | +/* #define OLD_SCTP_SOCKET_API */ |
| 17 | + |
| 18 | +/* Automatically fallback to old API if some of the new symbols are not defined */ |
| 19 | +#if (!defined(SCTP_CONNECTX_4_ARGS) || (!defined(SCTP_RECVRCVINFO)) || (!defined(SCTP_SNDINFO))) |
| 20 | +# define OLD_SCTP_SOCKET_API |
| 21 | +#endif |
| 22 | === |
| 23 | |
| 24 | SCTP_RECVRCVINFO is defined in <linux/sctp.h>, |
| 25 | but <linux/sctp.h> is't included in the source code |
| 26 | previouly. So defined(SCTP_RECVRCVINFO) can be 0 |
| 27 | and it make old sctp socket api definiton in effect |
| 28 | as below: |
| 29 | # define OLD_SCTP_SOCKET_API |
| 30 | |
| 31 | After lksctp-tools upgrade to 1.0.18, there is below |
| 32 | commit introduced: |
| 33 | === |
| 34 | commit 3c8bd0d26b64611c690f33f5802c734b0642c1d8 |
| 35 | Author: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> |
| 36 | Date: Tue Apr 17 20:17:14 2018 -0300 |
| 37 | |
| 38 | sctp.h: make use kernel UAPI header |
| 39 | |
| 40 | and with that, remove tons of duplicated declarations. These were |
| 41 | lagging behind the kernel header, which is always the most updated one, |
| 42 | and as the library is intended to be run only on Linux, there is no |
| 43 | reason that we cannot re-use what is in there. |
| 44 | |
| 45 | That said, this patch drops all duplicated declarations and includes |
| 46 | linux/sctp.h to bring them into lksctp-tools. |
| 47 | |
| 48 | Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> |
| 49 | |
| 50 | [snip] |
| 51 | #include <stdint.h> |
| 52 | #include <linux/types.h> |
| 53 | #include <sys/socket.h> |
| 54 | +#include <linux/sctp.h> |
| 55 | [snip] |
| 56 | === |
| 57 | |
| 58 | And above logic make defined(SCTP_RECVRCVINFO) to |
| 59 | be 1 and the old sctp socket api macro as below |
| 60 | won't be defined. |
| 61 | # define OLD_SCTP_SOCKET_API |
| 62 | |
| 63 | And it encouters below build error: |
| 64 | | /build/freediameter/1.2.1-r0/freeDiameter-1.2.1/libfdcore/sctp.c:1262:9: error: 'SCTP_SEND_FAILED_EVENT' undeclared (first use in this function); did you mean 'SCTP_SEND_FAILED'? |
| 65 | case SCTP_SEND_FAILED_EVENT: |
| 66 | ^~~~~~~~~~~~~~~~~~~~~~ |
| 67 | SCTP_SEND_FAILED |
| 68 | | /build/freediameter/1.2.1-r0/freeDiameter-1.2.1/libfdcore/sctp.c:1262:9: note: each undeclared identifier is reported only once for each function it appears in |
| 69 | | /build/freediameter/1.2.1-r0/freeDiameter-1.2.1/libfdcore/sctp.c:1274:9: error: 'SCTP_NOTIFICATIONS_STOPPED_EVENT' undeclared (first use in this function); did you mean 'SCTP_AUTHENTICATION_EVENT'? |
| 70 | case SCTP_NOTIFICATIONS_STOPPED_EVENT: |
| 71 | |
| 72 | Update the old sctp socket api check to fix |
| 73 | the above build error. |
| 74 | |
| 75 | Upstream-Status: Pending |
| 76 | |
| 77 | Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com> |
| 78 | --- |
| 79 | libfdcore/sctp.c | 2 +- |
| 80 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 81 | |
| 82 | diff --git a/libfdcore/sctp.c b/libfdcore/sctp.c |
| 83 | index c80a497..83440c7 100644 |
| 84 | --- a/libfdcore/sctp.c |
| 85 | +++ b/libfdcore/sctp.c |
| 86 | @@ -48,7 +48,7 @@ |
| 87 | /* #define OLD_SCTP_SOCKET_API */ |
| 88 | |
| 89 | /* Automatically fallback to old API if some of the new symbols are not defined */ |
| 90 | -#if (!defined(SCTP_CONNECTX_4_ARGS) || (!defined(SCTP_RECVRCVINFO)) || (!defined(SCTP_SNDINFO))) |
| 91 | +#if (!defined(SCTP_CONNECTX_4_ARGS) || (!defined(SCTP_NOTIFICATIONS_STOPPED_EVENT)) || (!defined(SCTP_SNDINFO))) |
| 92 | # define OLD_SCTP_SOCKET_API |
| 93 | #endif |
| 94 | |
| 95 | -- |
| 96 | 2.7.4 |
| 97 | |