【问题标题】:How to configure DTLS echo server and client code?如何配置 DTLS 回显服务器和客户端代码?
【发布时间】:2018-05-12 23:34:11
【问题描述】:

我找到了 DTLS SCTP 示例代码的网络档案。 http://web.archive.org/web/20150617012520/http://sctp.fh-muenster.de/dtls-samples.html

我想运行 DTLS 回显服务器和客户端。但是,我无法编译。 以下是错误内容:

$gcc dtls-over-sctp-echo.c -o main -I /usr/local/ssl/include -L/usr/local/ssl/lib -lssl -lcrypto -lpthread -Wall
         dtls-over-sctp-echo.c: In function ‘connection_handle’:
        dtls-over-sctp-echo.c:219:32: error: storage size of ‘rinfo’ isn’t known
          struct bio_dgram_sctp_rcvinfo rinfo;
                                        ^
        dtls-over-sctp-echo.c:228:8: warning: implicit declaration of function ‘BIO_new_dgram_sctp’ [-Wimplicit-function-declaration]
          bio = BIO_new_dgram_sctp(pinfo->fd, BIO_NOCLOSE);
                ^
        dtls-over-sctp-echo.c:228:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
          bio = BIO_new_dgram_sctp(pinfo->fd, BIO_NOCLOSE);
              ^
        dtls-over-sctp-echo.c:232:3: warning: implicit declaration of function ‘BIO_dgram_sctp_notification_cb’ [-Wimplicit-function-declaration]
           BIO_dgram_sctp_notification_cb(bio, &handle_notifications, (void*) ssl);
           ^
        dtls-over-sctp-echo.c:291:21: error: ‘BIO_CTRL_DGRAM_SCTP_GET_RCVINFO’ undeclared (first use in this function)
               BIO_ctrl(bio, BIO_CTRL_DGRAM_SCTP_GET_RCVINFO, sizeof(struct bio_dgram_sctp_rcvinfo), &rinf
                             ^
        dtls-over-sctp-echo.c:291:21: note: each undeclared identifier is reported only once for each function it appears in
        dtls-over-sctp-echo.c:291:61: error: invalid application of ‘sizeof’ to incomplete type ‘struct bio_dgram_sctp_rcvinfo’
               BIO_ctrl(bio, BIO_CTRL_DGRAM_SCTP_GET_RCVINFO, sizeof(struct bio_dgram_sctp_rcvinfo), &rinf

谢谢!

【问题讨论】:

  • 听起来您缺少#include <openssl/bio.h>。或者,您安装的 OpenSSL 包是否与示例代码预期的版本明显不同?
  • 1.参考[1]stackoverflow.com/questions/20068706/… -- sysctl -w net.sctp.auth_enable=1

标签: openssl sctp dtls


【解决方案1】:
  1. 尝试使用以下命令再次构建 openssl 源代码:

    ./config --prefix=/usr --openssldir=/usr/lib/ssl --libdir=lib shared sctp

  2. 安装 openssl

  3. 使用新的 openssl 库重建 dtls_sctp_echo.c

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-08-13
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多