aboutgitcodebugslistschat
path: root/udp.c
diff options
context:
space:
mode:
Diffstat (limited to 'udp.c')
-rw-r--r--udp.c47
1 files changed, 15 insertions, 32 deletions
diff --git a/udp.c b/udp.c
index d835a89..25a37c6 100644
--- a/udp.c
+++ b/udp.c
@@ -532,50 +532,33 @@ static void udp_sock_handler_splice(const struct ctx *c, union epoll_ref ref,
}
- if (ref.r.p.udp.udp.orig && !ref.r.p.udp.udp.ns) {
- src += c->udp.fwd_out.rdelta[src];
-
- if (!(s = udp_splice_ns[v6][src].sock)) {
- struct udp_splice_new_ns_arg arg = {
- c, v6, src, -1,
- };
-
- NS_CALL(udp_splice_new_ns, &arg);
- if ((s = arg.s) < 0)
- return;
- }
-
- udp_splice_init[v6][dst].ts = now->tv_sec;
- udp_splice_ns[v6][src].ts = now->tv_sec;
- } else if (!ref.r.p.udp.udp.orig && ref.r.p.udp.udp.ns) {
+ if (ref.r.p.udp.udp.ns) {
src += c->udp.fwd_in.rdelta[src];
+ s = udp_splice_init[v6][src].sock;
+ if (!s && ref.r.p.udp.udp.orig)
+ s = udp_splice_new(c, v6, src, false);
- if (!(s = udp_splice_init[v6][src].sock))
+ if (s < 0)
return;
udp_splice_ns[v6][dst].ts = now->tv_sec;
udp_splice_init[v6][src].ts = now->tv_sec;
- } else if (ref.r.p.udp.udp.orig && ref.r.p.udp.udp.ns) {
- src += c->udp.fwd_in.rdelta[src];
-
- if (!(s = udp_splice_init[v6][src].sock)) {
- s = udp_splice_new(c, v6, src, false);
- if (s < 0)
- return;
- }
-
- udp_splice_ns[v6][dst].ts = now->tv_sec;
- udp_splice_init[v6][src].ts = now->tv_sec;
- } else if (!ref.r.p.udp.udp.orig && !ref.r.p.udp.udp.ns) {
+ } else {
src += c->udp.fwd_out.rdelta[src];
+ s = udp_splice_ns[v6][src].sock;
+ if (!s && ref.r.p.udp.udp.orig) {
+ struct udp_splice_new_ns_arg arg = {
+ c, v6, src, -1,
+ };
- if (!(s = udp_splice_ns[v6][src].sock))
+ NS_CALL(udp_splice_new_ns, &arg);
+ s = arg.s;
+ }
+ if (s < 0)
return;
udp_splice_init[v6][dst].ts = now->tv_sec;
udp_splice_ns[v6][src].ts = now->tv_sec;
- } else {
- return;
}
for (i = 0; i < n; i++) {