- moved the sctp specific code from core to a module to make it easy to
enable/disable sctp by loading/not loading the module instead of
recompiling
1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,55 +0,0 @@ |
1 |
-/* |
|
2 |
- * $Id$ |
|
3 |
- * |
|
4 |
- * Copyright (C) 2008 iptelorg GmbH |
|
5 |
- * |
|
6 |
- * Permission to use, copy, modify, and distribute this software for any |
|
7 |
- * purpose with or without fee is hereby granted, provided that the above |
|
8 |
- * copyright notice and this permission notice appear in all copies. |
|
9 |
- * |
|
10 |
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|
11 |
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|
12 |
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
|
13 |
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|
14 |
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|
15 |
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|
16 |
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
17 |
- */ |
|
18 |
-/* |
|
19 |
- * sctp one to many |
|
20 |
- */ |
|
21 |
-/* |
|
22 |
- * History: |
|
23 |
- * -------- |
|
24 |
- * 2008-08-07 initial version (andrei) |
|
25 |
- */ |
|
26 |
- |
|
27 |
-#ifndef _sctp_server_h |
|
28 |
-#define _sctp_server_h |
|
29 |
- |
|
30 |
-#include "ip_addr.h" |
|
31 |
- |
|
32 |
-struct sctp_gen_info{ |
|
33 |
- int sctp_connections_no; |
|
34 |
- int sctp_tracked_no; |
|
35 |
- int sctp_total_connections; |
|
36 |
-}; |
|
37 |
- |
|
38 |
-int init_sctp(void); |
|
39 |
-void destroy_sctp(void); |
|
40 |
-int sctp_check_compiled_sockopts(char* buf, int size); |
|
41 |
-int sctp_check_support(void); |
|
42 |
-int sctp_init_sock(struct socket_info* sock_info); |
|
43 |
-int sctp_rcv_loop(void); |
|
44 |
-int sctp_msg_send(struct dest_info* dst, char* buf, unsigned len); |
|
45 |
- |
|
46 |
-/* generic sctp information (stats a.s.o) */ |
|
47 |
-void sctp_get_info(struct sctp_gen_info* sinf); |
|
48 |
- |
|
49 |
-void destroy_sctp(void); |
|
50 |
- |
|
51 |
-int sctp_setsockopt(int s, int level, int optname, |
|
52 |
- void* optval, socklen_t optlen, char* err_prefix); |
|
53 |
- |
|
54 |
-void sctp_con_tracking_flush(void); |
|
55 |
-#endif /* _sctp_server_h */ |
In C language, a declaration in the form int f(); is equivalent to int f(...);, thus being able to accept an indefinit number of parameters. With the -Wstrict-prototypes GCC options, these declarations are reported as "function declaration isn’t a prototype".
On some cases, this may trick the compiler into generating unoptimized code (like preparing to handle variadic argument list).
In all cases having a declaration int f() and a definition inf f(int) is missleading, even if standard compliant.
This is still Work in Progress. (maybe adding the -Wstrict-prototypes option to default is desireable)
... | ... |
@@ -35,21 +35,21 @@ struct sctp_gen_info{ |
35 | 35 |
int sctp_total_connections; |
36 | 36 |
}; |
37 | 37 |
|
38 |
-int init_sctp(); |
|
39 |
-void destroy_sctp(); |
|
38 |
+int init_sctp(void); |
|
39 |
+void destroy_sctp(void); |
|
40 | 40 |
int sctp_check_compiled_sockopts(char* buf, int size); |
41 |
-int sctp_check_support(); |
|
41 |
+int sctp_check_support(void); |
|
42 | 42 |
int sctp_init_sock(struct socket_info* sock_info); |
43 |
-int sctp_rcv_loop(); |
|
43 |
+int sctp_rcv_loop(void); |
|
44 | 44 |
int sctp_msg_send(struct dest_info* dst, char* buf, unsigned len); |
45 | 45 |
|
46 | 46 |
/* generic sctp information (stats a.s.o) */ |
47 | 47 |
void sctp_get_info(struct sctp_gen_info* sinf); |
48 | 48 |
|
49 |
-void destroy_sctp(); |
|
49 |
+void destroy_sctp(void); |
|
50 | 50 |
|
51 | 51 |
int sctp_setsockopt(int s, int level, int optname, |
52 | 52 |
void* optval, socklen_t optlen, char* err_prefix); |
53 | 53 |
|
54 |
-void sctp_con_tracking_flush(); |
|
54 |
+void sctp_con_tracking_flush(void); |
|
55 | 55 |
#endif /* _sctp_server_h */ |
Association tracking can now be turned on/off at runtime.
Turning it off saves some memory and gives slightly better
performance at the cost of having to turn off some other features
that depend on it (right now that will be sctp_assoc_reuse).
- added new config and runtime options for controlling the
retransmissions at the sctp protocol level:
sctp_srto_initial - initial value of the retr. timeout used in
RTO calculations.
sctp_srto_max - maximum value of the retr. timeout (RTO).
sctp_srto_min - minimum value of the retr. timeout (RTO).
- on startup get the OS defaults for the sctp options so that
sercmd core.sctp_options always displays the options in use
(even if they haven't been "manually").
... | ... |
@@ -48,6 +48,6 @@ void sctp_get_info(struct sctp_gen_info* sinf); |
48 | 48 |
|
49 | 49 |
void destroy_sctp(); |
50 | 50 |
|
51 |
-int sctp_sockopt(struct socket_info* si, int level, int optname, void* optval, |
|
52 |
- socklen_t optlen, char* err_prefix); |
|
51 |
+int sctp_setsockopt(int s, int level, int optname, |
|
52 |
+ void* optval, socklen_t optlen, char* err_prefix); |
|
53 | 53 |
#endif /* _sctp_server_h */ |
sctp_autoclose can now be changed at runtime, but it will affect
only new associations (autoclose for the pre-existing ones will
not be changed).
E.g.:
$ sercmd cfg.set_now_int sctp autoclose 120
- support for sctp connection tracking and true sctp connection
reuse for replies.
We need this to support reply connection reuse with asymmetric
sctp peers (while there is no reason not to use the same port on
sctp for sending and receiving messages and it should be
strongly discouraged to do so, we never now with what
implementation we'll have to deal).
What makes this particularly complex is the not-yet-complete
sctp API, the slight but important behaviour
differences between its linux, freebsd and solaris
implementations and the fact that is more geared towards serial
single threaded application rather then parallel-processing
multi-process or multi-threaded ones.
- keep track of the number of active and tracked sctp connections
- blacklist moved into sctp_handles_assoc_change()
... | ... |
@@ -29,12 +29,23 @@ |
29 | 29 |
|
30 | 30 |
#include "ip_addr.h" |
31 | 31 |
|
32 |
+struct sctp_gen_info{ |
|
33 |
+ int sctp_connections_no; |
|
34 |
+ int sctp_tracked_no; |
|
35 |
+ int sctp_total_connections; |
|
36 |
+}; |
|
37 |
+ |
|
38 |
+int init_sctp(); |
|
39 |
+void destroy_sctp(); |
|
32 | 40 |
int sctp_check_compiled_sockopts(char* buf, int size); |
33 | 41 |
int sctp_check_support(); |
34 | 42 |
int sctp_init_sock(struct socket_info* sock_info); |
35 | 43 |
int sctp_rcv_loop(); |
36 | 44 |
int sctp_msg_send(struct dest_info* dst, char* buf, unsigned len); |
37 | 45 |
|
46 |
+/* generic sctp information (stats a.s.o) */ |
|
47 |
+void sctp_get_info(struct sctp_gen_info* sinf); |
|
48 |
+ |
|
38 | 49 |
void destroy_sctp(); |
39 | 50 |
|
40 | 51 |
#endif /* _sctp_server_h */ |
- try to compile even if the used sctp library doesn't support all the
sctp socket options that we would like to set, but warn about it both at
compile time and each time ser is started
- ser -V will print a list of unsupported sctp options (due to missing
support in the sctp library/*.h files that ser was compiled against)
- fix: the autoclose sctp socket option was not properly set (paste typo)
- added a new ser.cfg option: sctp_enable = 0|1|2. 0 means disable
(equivalent with sctp_disable=yes), 1 enable (sctp_disable=no) and
2 is auto mode (sctp enabled only if supported by the OS).
- sctp is now by default in auto enable mode: enabled if supported by the OS
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,38 @@ |
1 |
+/* |
|
2 |
+ * $Id$ |
|
3 |
+ * |
|
4 |
+ * Copyright (C) 2008 iptelorg GmbH |
|
5 |
+ * |
|
6 |
+ * Permission to use, copy, modify, and distribute this software for any |
|
7 |
+ * purpose with or without fee is hereby granted, provided that the above |
|
8 |
+ * copyright notice and this permission notice appear in all copies. |
|
9 |
+ * |
|
10 |
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|
11 |
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|
12 |
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
|
13 |
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|
14 |
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|
15 |
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|
16 |
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
17 |
+ */ |
|
18 |
+/* |
|
19 |
+ * sctp one to many |
|
20 |
+ */ |
|
21 |
+/* |
|
22 |
+ * History: |
|
23 |
+ * -------- |
|
24 |
+ * 2008-08-07 initial version (andrei) |
|
25 |
+ */ |
|
26 |
+ |
|
27 |
+#ifndef _sctp_server_h |
|
28 |
+#define _sctp_server_h |
|
29 |
+ |
|
30 |
+#include "ip_addr.h" |
|
31 |
+ |
|
32 |
+int sctp_init_sock(struct socket_info* sock_info); |
|
33 |
+int sctp_rcv_loop(); |
|
34 |
+int sctp_msg_send(struct dest_info* dst, char* buf, unsigned len); |
|
35 |
+ |
|
36 |
+void destroy_sctp(); |
|
37 |
+ |
|
38 |
+#endif /* _sctp_server_h */ |