comparison src/core/ngx_connection.c @ 9094:afebde21cb32 quic

QUIC: disabled datagram fragmentation. As per RFC 9000, Section 14: UDP datagrams MUST NOT be fragmented at the IP layer.
author Roman Arutyunyan <arut@nginx.com>
date Sat, 06 May 2023 16:23:27 +0400
parents af5adec171b4
children adcc6d8acfd4
comparison
equal deleted inserted replaced
9093:9ae24a9ba763 9094:afebde21cb32
1006 "setsockopt(IPV6_RECVPKTINFO) " 1006 "setsockopt(IPV6_RECVPKTINFO) "
1007 "for %V failed, ignored", 1007 "for %V failed, ignored",
1008 &ls[i].addr_text); 1008 &ls[i].addr_text);
1009 } 1009 }
1010 } 1010 }
1011
1012 #endif
1013
1014 #if (NGX_HAVE_IP_MTU_DISCOVER)
1015
1016 if (ls[i].quic && ls[i].sockaddr->sa_family == AF_INET) {
1017 value = IP_PMTUDISC_DO;
1018
1019 if (setsockopt(ls[i].fd, IPPROTO_IP, IP_MTU_DISCOVER,
1020 (const void *) &value, sizeof(int))
1021 == -1)
1022 {
1023 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
1024 "setsockopt(IP_MTU_DISCOVER) "
1025 "for %V failed, ignored",
1026 &ls[i].addr_text);
1027 }
1028 }
1029
1030 #elif (NGX_HAVE_IP_DONTFRAG)
1031
1032 if (ls[i].quic && ls[i].sockaddr->sa_family == AF_INET) {
1033 value = 1;
1034
1035 if (setsockopt(ls[i].fd, IPPROTO_IP, IP_DONTFRAG,
1036 (const void *) &value, sizeof(int))
1037 == -1)
1038 {
1039 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
1040 "setsockopt(IP_DONTFRAG) "
1041 "for %V failed, ignored",
1042 &ls[i].addr_text);
1043 }
1044 }
1045
1046 #endif
1047
1048 #if (NGX_HAVE_INET6)
1049
1050 #if (NGX_HAVE_IPV6_MTU_DISCOVER)
1051
1052 if (ls[i].quic && ls[i].sockaddr->sa_family == AF_INET6) {
1053 value = IPV6_PMTUDISC_DO;
1054
1055 if (setsockopt(ls[i].fd, IPPROTO_IPV6, IPV6_MTU_DISCOVER,
1056 (const void *) &value, sizeof(int))
1057 == -1)
1058 {
1059 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
1060 "setsockopt(IPV6_MTU_DISCOVER) "
1061 "for %V failed, ignored",
1062 &ls[i].addr_text);
1063 }
1064 }
1065
1066 #elif (NGX_HAVE_IP_DONTFRAG)
1067
1068 if (ls[i].quic && ls[i].sockaddr->sa_family == AF_INET6) {
1069 value = 1;
1070
1071 if (setsockopt(ls[i].fd, IPPROTO_IPV6, IPV6_DONTFRAG,
1072 (const void *) &value, sizeof(int))
1073 == -1)
1074 {
1075 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
1076 "setsockopt(IPV6_DONTFRAG) "
1077 "for %V failed, ignored",
1078 &ls[i].addr_text);
1079 }
1080 }
1081
1082 #endif
1011 1083
1012 #endif 1084 #endif
1013 } 1085 }
1014 1086
1015 return; 1087 return;