diff options
author | Mark Stapp <mjs@voltanet.io> | 2021-04-08 14:56:32 +0200 |
---|---|---|
committer | Mark Stapp <mjs@voltanet.io> | 2021-04-09 14:13:58 +0200 |
commit | 2a034138d452d331001f5af1d34db08ee6085d2b (patch) | |
tree | e54a0ae94e741859e3cee2b9bad1c21ae314341e /pceplib | |
parent | Merge pull request #8405 from mjstapp/skip_backup_lsps (diff) | |
download | frr-2a034138d452d331001f5af1d34db08ee6085d2b.tar.xz frr-2a034138d452d331001f5af1d34db08ee6085d2b.zip |
lib: use platform-neutral value for TCP MD5 signature len
Use a pcep-specific value for MD5SIG_MAXLEN, use the OS value if
present.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'pceplib')
-rw-r--r-- | pceplib/pcep.h | 14 | ||||
-rw-r--r-- | pceplib/pcep_pcc.c | 2 | ||||
-rw-r--r-- | pceplib/pcep_session_logic.h | 2 | ||||
-rw-r--r-- | pceplib/pcep_socket_comm.h | 6 |
4 files changed, 15 insertions, 9 deletions
diff --git a/pceplib/pcep.h b/pceplib/pcep.h index 278ab9d5d..b5d02c7e6 100644 --- a/pceplib/pcep.h +++ b/pceplib/pcep.h @@ -28,12 +28,10 @@ #endif #if defined(linux) || defined(GNU_LINUX) -//#include <netinet/in.h> + #define ipv6_u __in6_u #else -// bsd family -#define TCP_MD5SIG_MAXKEYLEN 80 -//#include <netinet/in.h> +/* bsd family */ #define ipv6_u __u6_addr #ifdef __FreeBSD__ #include <sys/endian.h> @@ -45,4 +43,12 @@ #include <sys/socket.h> #include <netinet/in.h> #include <pthread.h> + +/* Cross-compilation seems to have trouble finding this */ +#if defined(TCP_MD5SIG_MAXKEYLEN) +#define PCEP_MD5SIG_MAXKEYLEN TCP_MD5SIG_MAXKEYLEN +#else +#define PCEP_MD5SIG_MAXKEYLEN 80 +#endif + #endif diff --git a/pceplib/pcep_pcc.c b/pceplib/pcep_pcc.c index 1a702a8b6..d263f64f3 100644 --- a/pceplib/pcep_pcc.c +++ b/pceplib/pcep_pcc.c @@ -53,7 +53,7 @@ struct cmd_line_args { char dest_ip_str[MAX_DST_IP_STR]; short src_tcp_port; short dest_tcp_port; - char tcp_md5_str[TCP_MD5SIG_MAXKEYLEN]; /* RFC 2385 */ + char tcp_md5_str[PCEP_MD5SIG_MAXKEYLEN]; /* RFC 2385 */ bool is_ipv6; bool eventpoll; /* poll for pcep_event's, or use callback (default) */ }; diff --git a/pceplib/pcep_session_logic.h b/pceplib/pcep_session_logic.h index a082ec66d..9cdec5250 100644 --- a/pceplib/pcep_session_logic.h +++ b/pceplib/pcep_session_logic.h @@ -122,7 +122,7 @@ typedef struct pcep_configuration_ { struct pcep_versioning *pcep_msg_versioning; - char tcp_authentication_str[TCP_MD5SIG_MAXKEYLEN]; + char tcp_authentication_str[PCEP_MD5SIG_MAXKEYLEN]; bool is_tcp_auth_md5; /* true: RFC 2385, false: RFC 5925 */ } pcep_configuration; diff --git a/pceplib/pcep_socket_comm.h b/pceplib/pcep_socket_comm.h index 797ffda86..89d249291 100644 --- a/pceplib/pcep_socket_comm.h +++ b/pceplib/pcep_socket_comm.h @@ -91,9 +91,9 @@ typedef struct pcep_socket_comm_session_ { int received_bytes; bool close_after_write; void *external_socket_data; /* used for external socket infra */ - char tcp_authentication_str[TCP_MD5SIG_MAXKEYLEN - + 1]; /* should be used with is_tcp_auth_md5 - flag */ + /* should be used with is_tcp_auth_md5 flag */ + char tcp_authentication_str[PCEP_MD5SIG_MAXKEYLEN + 1]; + bool is_tcp_auth_md5; /* flag to distinguish between rfc 2385 (md5) and rfc 5925 (tcp-ao) */ |