Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
2aed0777
Commit
2aed0777
authored
Nov 06, 2021
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge fd_set_recv_ecn to create_quic_server_socket and handle errors
parent
68b2295f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
27 deletions
+18
-27
src/shrpx_worker.cc
src/shrpx_worker.cc
+18
-2
src/util.cc
src/util.cc
+0
-23
src/util.h
src/util.h
+0
-2
No files found.
src/shrpx_worker.cc
View file @
2aed0777
...
@@ -834,6 +834,15 @@ int Worker::create_quic_server_socket(UpstreamAddr &faddr) {
...
@@ -834,6 +834,15 @@ int Worker::create_quic_server_socket(UpstreamAddr &faddr) {
continue
;
continue
;
}
}
if
(
setsockopt
(
fd
,
IPPROTO_IPV6
,
IPV6_RECVTCLASS
,
&
val
,
static_cast
<
socklen_t
>
(
sizeof
(
val
)))
==
-
1
)
{
auto
error
=
errno
;
LOG
(
WARN
)
<<
"Failed to set IPV6_RECVTCLASS option to listener socket: "
<<
xsi_strerror
(
error
,
errbuf
.
data
(),
errbuf
.
size
());
close
(
fd
);
continue
;
}
# if defined(IPV6_MTU_DISCOVER) && defined(IP_PMTUDISC_DO)
# if defined(IPV6_MTU_DISCOVER) && defined(IP_PMTUDISC_DO)
int
mtu_disc
=
IP_PMTUDISC_DO
;
int
mtu_disc
=
IP_PMTUDISC_DO
;
if
(
setsockopt
(
fd
,
IPPROTO_IPV6
,
IPV6_MTU_DISCOVER
,
&
mtu_disc
,
if
(
setsockopt
(
fd
,
IPPROTO_IPV6
,
IPV6_MTU_DISCOVER
,
&
mtu_disc
,
...
@@ -856,6 +865,15 @@ int Worker::create_quic_server_socket(UpstreamAddr &faddr) {
...
@@ -856,6 +865,15 @@ int Worker::create_quic_server_socket(UpstreamAddr &faddr) {
continue
;
continue
;
}
}
if
(
setsockopt
(
fd
,
IPPROTO_IP
,
IP_RECVTOS
,
&
val
,
static_cast
<
socklen_t
>
(
sizeof
(
val
)))
==
-
1
)
{
auto
error
=
errno
;
LOG
(
WARN
)
<<
"Failed to set IP_RECVTOS option to listener socket: "
<<
xsi_strerror
(
error
,
errbuf
.
data
(),
errbuf
.
size
());
close
(
fd
);
continue
;
}
# if defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO)
# if defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO)
int
mtu_disc
=
IP_PMTUDISC_DO
;
int
mtu_disc
=
IP_PMTUDISC_DO
;
if
(
setsockopt
(
fd
,
IPPROTO_IP
,
IP_MTU_DISCOVER
,
&
mtu_disc
,
if
(
setsockopt
(
fd
,
IPPROTO_IP
,
IP_MTU_DISCOVER
,
&
mtu_disc
,
...
@@ -869,8 +887,6 @@ int Worker::create_quic_server_socket(UpstreamAddr &faddr) {
...
@@ -869,8 +887,6 @@ int Worker::create_quic_server_socket(UpstreamAddr &faddr) {
# endif // defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO)
# endif // defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO)
}
}
util
::
fd_set_recv_ecn
(
fd
,
faddr
.
family
);
if
(
bind
(
fd
,
rp
->
ai_addr
,
rp
->
ai_addrlen
)
==
-
1
)
{
if
(
bind
(
fd
,
rp
->
ai_addr
,
rp
->
ai_addrlen
)
==
-
1
)
{
auto
error
=
errno
;
auto
error
=
errno
;
LOG
(
WARN
)
<<
"bind() syscall failed: "
LOG
(
WARN
)
<<
"bind() syscall failed: "
...
...
src/util.cc
View file @
2aed0777
...
@@ -1748,29 +1748,6 @@ unsigned int msghdr_get_ecn(msghdr *msg, int family) {
...
@@ -1748,29 +1748,6 @@ unsigned int msghdr_get_ecn(msghdr *msg, int family) {
return
0
;
return
0
;
}
}
int
fd_set_recv_ecn
(
int
fd
,
int
family
)
{
unsigned
int
tos
=
1
;
switch
(
family
)
{
case
AF_INET
:
if
(
setsockopt
(
fd
,
IPPROTO_IP
,
IP_RECVTOS
,
&
tos
,
static_cast
<
socklen_t
>
(
sizeof
(
tos
)))
==
-
1
)
{
return
-
1
;
}
return
0
;
case
AF_INET6
:
if
(
setsockopt
(
fd
,
IPPROTO_IPV6
,
IPV6_RECVTCLASS
,
&
tos
,
static_cast
<
socklen_t
>
(
sizeof
(
tos
)))
==
-
1
)
{
return
-
1
;
}
return
0
;
}
return
-
1
;
}
int
fd_set_send_ecn
(
int
fd
,
int
family
,
unsigned
int
ecn
)
{
int
fd_set_send_ecn
(
int
fd
,
int
family
,
unsigned
int
ecn
)
{
switch
(
family
)
{
switch
(
family
)
{
case
AF_INET
:
case
AF_INET
:
...
...
src/util.h
View file @
2aed0777
...
@@ -921,8 +921,6 @@ int msghdr_get_local_addr(Address &dest, msghdr *msg, int family);
...
@@ -921,8 +921,6 @@ int msghdr_get_local_addr(Address &dest, msghdr *msg, int family);
unsigned
int
msghdr_get_ecn
(
msghdr
*
msg
,
int
family
);
unsigned
int
msghdr_get_ecn
(
msghdr
*
msg
,
int
family
);
int
fd_set_recv_ecn
(
int
fd
,
int
family
);
int
fd_set_send_ecn
(
int
fd
,
int
family
,
unsigned
int
ecn
);
int
fd_set_send_ecn
(
int
fd
,
int
family
,
unsigned
int
ecn
);
#endif // ENABLE_HTTP3
#endif // ENABLE_HTTP3
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment