header file netinet/sctp.h is missing by default
liuqun opened this issue · comments
刘群 commented
I was testing under Ubuntu 19.04, and got such gcc errors:
DTLS-Examples/src$ make
cc -std=c99 -pedantic -Wall -g -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-overlength-strings -I/usr/local/include -o dtls_sctp_chargen dtls_sctp_chargen.c -L/usr/local/lib -lssl -lcrypto -pthread -lm -ldl
dtls_sctp_chargen.c:48:10: fatal error: netinet/sctp.h: No such file or directory
#include <netinet/sctp.h>
^~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:21: dtls_sctp_chargen] Error 1
suggestion:
sudo apt-get install libsctp-dev
$ dpkg-query --listfiles libsctp-dev
/usr/include/netinet
/usr/include/netinet/sctp.h
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libsctp.a
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/libsctp.pc
...
刘群 commented
After libsctp-dev was installed, other errors occurred due to that the SCTP option in OpenSSL 1.1.1b (shipped with Ubuntu 19.04) was disabled...
DTLS-Examples/src$ make
cc -std=c99 -pedantic -Wall -g -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-overlength-strings -I/usr/local/include -o dtls_sctp_chargen dtls_sctp_chargen.c -L/usr/local/lib -lssl -lcrypto -pthread -lm -ldl
dtls_sctp_chargen.c: In function ‘connection_handle’:
dtls_sctp_chargen.c:278:32: error: storage size of ‘sinfo’ isn’t known
struct bio_dgram_sctp_sndinfo sinfo;
^~~~~
dtls_sctp_chargen.c:279:32: error: storage size of ‘rinfo’ isn’t known
struct bio_dgram_sctp_rcvinfo rinfo;
^~~~~
...
So, I guess I need to build openssl locally with SCTP support enabled.
361 #ifndef OPENSSL_NO_SCTP
362 /* SCTP parameter structs */
363 struct bio_dgram_sctp_sndinfo
364 {
365 uint16_t snd_sid;
366 uint16_t snd_flags;
367 uint32_t snd_ppid;
368 uint32_t snd_context;
369 };
370
371 struct bio_dgram_sctp_rcvinfo
372 {
373 uint16_t rcv_sid;
374 uint16_t rcv_ssn;
375 uint16_t rcv_flags;
376 uint32_t rcv_ppid;
377 uint32_t rcv_tsn;
378 uint32_t rcv_cumtsn;
379 uint32_t rcv_context;
380 };
381
382 struct bio_dgram_sctp_prinfo
383 {
384 uint16_t pr_policy;
385 uint32_t pr_value;
386 };
387 #endif
Michael Tüxen commented
suggestion:
sudo apt-get install libsctp-dev
I added that to the README.md
. Thanks for the suggestion.
Michael Tüxen commented
So, I guess I need to build openssl locally with SCTP support enabled.
That is correct. This is described in README.md.