File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -448,7 +448,11 @@ void picoquic_socks_cmsg_parse(
448448 }
449449 }
450450#endif
451- else if ((cmsg -> cmsg_type == IP_TOS || cmsg -> cmsg_type == IP_RECVTOS ) && cmsg -> cmsg_len > 0 ) {
451+ else if ((cmsg -> cmsg_type == IP_TOS
452+ #ifdef IP_RECVTOS
453+ || cmsg -> cmsg_type == IP_RECVTOS
454+ #endif
455+ ) && cmsg -> cmsg_len > 0 ) {
452456 if (received_ecn != NULL ) {
453457 * received_ecn = * ((unsigned char * )CMSG_DATA (cmsg ));
454458 }
@@ -641,8 +645,15 @@ void picoquic_socks_cmsg_format(
641645 }
642646#else
643647 /* The IP_PKTINFO structure is not defined on BSD */
648+ /* Some versions of freeBSD do not define IP_SENDSRCADDR, use IP_RECVDSTADDR instead. */
644649 struct in_addr * pktinfo = (struct in_addr * )cmsg_format_header_return_data_ptr (msg , & last_cmsg ,
645- & control_length , IPPROTO_IP , IP_SENDSRCADDR , sizeof (struct in_addr ));
650+ & control_length , IPPROTO_IP ,
651+ #ifdef IP_SENDSRCADDR
652+ IP_SENDSRCADDR
653+ #else
654+ IP_RECVDSTADDR
655+ #endif
656+ , sizeof (struct in_addr ));
646657 if (pktinfo != NULL ) {
647658 pktinfo -> s_addr = ((struct sockaddr_in * )addr_from )-> sin_addr .s_addr ;
648659 }
You can’t perform that action at this time.
0 commit comments