Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 1 | /* |
| 2 | * AF_INET/AF_INET6 QUIC protocol layer. |
| 3 | * |
Willy Tarreau | 3dfb7da | 2022-03-02 22:33:39 +0100 | [diff] [blame] | 4 | * Copyright 2020 Frederic Lecaille <flecaille@haproxy.com> |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | #include <ctype.h> |
| 14 | #include <errno.h> |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 15 | #include <stdio.h> |
| 16 | #include <stdlib.h> |
| 17 | #include <string.h> |
| 18 | #include <time.h> |
| 19 | |
| 20 | #include <sys/param.h> |
| 21 | #include <sys/socket.h> |
| 22 | #include <sys/types.h> |
| 23 | |
| 24 | #include <netinet/udp.h> |
| 25 | #include <netinet/in.h> |
| 26 | |
| 27 | #include <haproxy/api.h> |
| 28 | #include <haproxy/arg.h> |
Frédéric Lécaille | 48f8e19 | 2021-07-06 15:39:26 +0200 | [diff] [blame] | 29 | #include <haproxy/cbuf.h> |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 30 | #include <haproxy/connection.h> |
| 31 | #include <haproxy/errors.h> |
| 32 | #include <haproxy/fd.h> |
| 33 | #include <haproxy/global.h> |
| 34 | #include <haproxy/list.h> |
| 35 | #include <haproxy/listener.h> |
| 36 | #include <haproxy/log.h> |
| 37 | #include <haproxy/namespace.h> |
| 38 | #include <haproxy/port_range.h> |
| 39 | #include <haproxy/protocol.h> |
| 40 | #include <haproxy/proto_quic.h> |
| 41 | #include <haproxy/proto_udp.h> |
| 42 | #include <haproxy/proxy-t.h> |
| 43 | #include <haproxy/sock.h> |
Frédéric Lécaille | 70da889 | 2020-11-06 15:49:49 +0100 | [diff] [blame] | 44 | #include <haproxy/quic_sock.h> |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 45 | #include <haproxy/sock_inet.h> |
| 46 | #include <haproxy/tools.h> |
Frédéric Lécaille | 25bc887 | 2022-01-27 09:15:40 +0100 | [diff] [blame] | 47 | #include <haproxy/xprt_quic.h> |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 48 | |
Amaury Denoyelle | 8524f0f | 2022-02-08 15:03:40 +0100 | [diff] [blame] | 49 | /* per-thread quic datagram handlers */ |
| 50 | struct quic_dghdlr *quic_dghdlrs; |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 51 | |
Frédéric Lécaille | 71f3abb | 2022-02-15 16:59:48 +0100 | [diff] [blame] | 52 | /* Size of the internal buffer of QUIC RX buffer at the fd level */ |
| 53 | #define QUIC_RX_BUFSZ (1UL << 18) |
| 54 | |
Willy Tarreau | b8dec4a | 2022-06-23 11:02:08 +0200 | [diff] [blame] | 55 | DECLARE_STATIC_POOL(pool_head_quic_rxbuf, "quic_rxbuf", QUIC_RX_BUFSZ); |
Frédéric Lécaille | 71f3abb | 2022-02-15 16:59:48 +0100 | [diff] [blame] | 56 | |
Frédéric Lécaille | 884f2e9 | 2020-11-23 14:23:21 +0100 | [diff] [blame] | 57 | static void quic_add_listener(struct protocol *proto, struct listener *listener); |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 58 | static int quic_bind_listener(struct listener *listener, char *errmsg, int errlen); |
| 59 | static int quic_connect_server(struct connection *conn, int flags); |
| 60 | static void quic_enable_listener(struct listener *listener); |
| 61 | static void quic_disable_listener(struct listener *listener); |
| 62 | |
| 63 | /* Note: must not be declared <const> as its list will be overwritten */ |
| 64 | struct protocol proto_quic4 = { |
| 65 | .name = "quic4", |
| 66 | |
| 67 | /* connection layer */ |
Willy Tarreau | 91b4726 | 2022-05-20 16:36:46 +0200 | [diff] [blame] | 68 | .xprt_type = PROTO_TYPE_STREAM, |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 69 | .listen = quic_bind_listener, |
| 70 | .enable = quic_enable_listener, |
| 71 | .disable = quic_disable_listener, |
Frédéric Lécaille | 884f2e9 | 2020-11-23 14:23:21 +0100 | [diff] [blame] | 72 | .add = quic_add_listener, |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 73 | .unbind = default_unbind_listener, |
| 74 | .suspend = default_suspend_listener, |
| 75 | .resume = default_resume_listener, |
Frédéric Lécaille | 70da889 | 2020-11-06 15:49:49 +0100 | [diff] [blame] | 76 | .accept_conn = quic_sock_accept_conn, |
Willy Tarreau | cdf7c8e | 2022-04-11 16:20:00 +0200 | [diff] [blame] | 77 | .get_src = quic_sock_get_src, |
| 78 | .get_dst = quic_sock_get_dst, |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 79 | .connect = quic_connect_server, |
| 80 | |
| 81 | /* binding layer */ |
| 82 | .rx_suspend = udp_suspend_receiver, |
| 83 | .rx_resume = udp_resume_receiver, |
| 84 | |
| 85 | /* address family */ |
| 86 | .fam = &proto_fam_inet4, |
| 87 | |
| 88 | /* socket layer */ |
Willy Tarreau | 337edfd | 2021-10-27 17:05:36 +0200 | [diff] [blame] | 89 | .proto_type = PROTO_TYPE_DGRAM, |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 90 | .sock_type = SOCK_DGRAM, |
| 91 | .sock_prot = IPPROTO_UDP, |
| 92 | .rx_enable = sock_enable, |
| 93 | .rx_disable = sock_disable, |
| 94 | .rx_unbind = sock_unbind, |
Frédéric Lécaille | 70da889 | 2020-11-06 15:49:49 +0100 | [diff] [blame] | 95 | .rx_listening = quic_sock_accepting_conn, |
| 96 | .default_iocb = quic_sock_fd_iocb, |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 97 | .receivers = LIST_HEAD_INIT(proto_quic4.receivers), |
| 98 | .nb_receivers = 0, |
| 99 | }; |
| 100 | |
| 101 | INITCALL1(STG_REGISTER, protocol_register, &proto_quic4); |
| 102 | |
| 103 | /* Note: must not be declared <const> as its list will be overwritten */ |
| 104 | struct protocol proto_quic6 = { |
| 105 | .name = "quic6", |
| 106 | |
| 107 | /* connection layer */ |
Willy Tarreau | 91b4726 | 2022-05-20 16:36:46 +0200 | [diff] [blame] | 108 | .xprt_type = PROTO_TYPE_STREAM, |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 109 | .listen = quic_bind_listener, |
| 110 | .enable = quic_enable_listener, |
| 111 | .disable = quic_disable_listener, |
Frédéric Lécaille | 884f2e9 | 2020-11-23 14:23:21 +0100 | [diff] [blame] | 112 | .add = quic_add_listener, |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 113 | .unbind = default_unbind_listener, |
| 114 | .suspend = default_suspend_listener, |
| 115 | .resume = default_resume_listener, |
Frédéric Lécaille | 70da889 | 2020-11-06 15:49:49 +0100 | [diff] [blame] | 116 | .accept_conn = quic_sock_accept_conn, |
Willy Tarreau | cdf7c8e | 2022-04-11 16:20:00 +0200 | [diff] [blame] | 117 | .get_src = quic_sock_get_src, |
| 118 | .get_dst = quic_sock_get_dst, |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 119 | .connect = quic_connect_server, |
| 120 | |
| 121 | /* binding layer */ |
| 122 | .rx_suspend = udp_suspend_receiver, |
| 123 | .rx_resume = udp_resume_receiver, |
| 124 | |
| 125 | /* address family */ |
| 126 | .fam = &proto_fam_inet6, |
| 127 | |
| 128 | /* socket layer */ |
Willy Tarreau | 337edfd | 2021-10-27 17:05:36 +0200 | [diff] [blame] | 129 | .proto_type = PROTO_TYPE_DGRAM, |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 130 | .sock_type = SOCK_DGRAM, |
| 131 | .sock_prot = IPPROTO_UDP, |
| 132 | .rx_enable = sock_enable, |
| 133 | .rx_disable = sock_disable, |
| 134 | .rx_unbind = sock_unbind, |
Frédéric Lécaille | 70da889 | 2020-11-06 15:49:49 +0100 | [diff] [blame] | 135 | .rx_listening = quic_sock_accepting_conn, |
| 136 | .default_iocb = quic_sock_fd_iocb, |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 137 | .receivers = LIST_HEAD_INIT(proto_quic6.receivers), |
| 138 | .nb_receivers = 0, |
| 139 | }; |
| 140 | |
| 141 | INITCALL1(STG_REGISTER, protocol_register, &proto_quic6); |
| 142 | |
| 143 | /* Binds ipv4/ipv6 address <local> to socket <fd>, unless <flags> is set, in which |
| 144 | * case we try to bind <remote>. <flags> is a 2-bit field consisting of : |
| 145 | * - 0 : ignore remote address (may even be a NULL pointer) |
| 146 | * - 1 : use provided address |
| 147 | * - 2 : use provided port |
| 148 | * - 3 : use both |
| 149 | * |
| 150 | * The function supports multiple foreign binding methods : |
| 151 | * - linux_tproxy: we directly bind to the foreign address |
| 152 | * The second one can be used as a fallback for the first one. |
| 153 | * This function returns 0 when everything's OK, 1 if it could not bind, to the |
| 154 | * local address, 2 if it could not bind to the foreign address. |
| 155 | */ |
| 156 | int quic_bind_socket(int fd, int flags, struct sockaddr_storage *local, struct sockaddr_storage *remote) |
| 157 | { |
| 158 | struct sockaddr_storage bind_addr; |
| 159 | int foreign_ok = 0; |
| 160 | int ret; |
| 161 | static THREAD_LOCAL int ip_transp_working = 1; |
| 162 | static THREAD_LOCAL int ip6_transp_working = 1; |
| 163 | |
| 164 | switch (local->ss_family) { |
| 165 | case AF_INET: |
| 166 | if (flags && ip_transp_working) { |
| 167 | /* This deserves some explanation. Some platforms will support |
| 168 | * multiple combinations of certain methods, so we try the |
| 169 | * supported ones until one succeeds. |
| 170 | */ |
| 171 | if (sock_inet4_make_foreign(fd)) |
| 172 | foreign_ok = 1; |
| 173 | else |
| 174 | ip_transp_working = 0; |
| 175 | } |
| 176 | break; |
| 177 | case AF_INET6: |
| 178 | if (flags && ip6_transp_working) { |
| 179 | if (sock_inet6_make_foreign(fd)) |
| 180 | foreign_ok = 1; |
| 181 | else |
| 182 | ip6_transp_working = 0; |
| 183 | } |
| 184 | break; |
| 185 | } |
| 186 | |
| 187 | if (flags) { |
| 188 | memset(&bind_addr, 0, sizeof(bind_addr)); |
| 189 | bind_addr.ss_family = remote->ss_family; |
| 190 | switch (remote->ss_family) { |
| 191 | case AF_INET: |
| 192 | if (flags & 1) |
| 193 | ((struct sockaddr_in *)&bind_addr)->sin_addr = ((struct sockaddr_in *)remote)->sin_addr; |
| 194 | if (flags & 2) |
| 195 | ((struct sockaddr_in *)&bind_addr)->sin_port = ((struct sockaddr_in *)remote)->sin_port; |
| 196 | break; |
| 197 | case AF_INET6: |
| 198 | if (flags & 1) |
| 199 | ((struct sockaddr_in6 *)&bind_addr)->sin6_addr = ((struct sockaddr_in6 *)remote)->sin6_addr; |
| 200 | if (flags & 2) |
| 201 | ((struct sockaddr_in6 *)&bind_addr)->sin6_port = ((struct sockaddr_in6 *)remote)->sin6_port; |
| 202 | break; |
| 203 | default: |
| 204 | /* we don't want to try to bind to an unknown address family */ |
| 205 | foreign_ok = 0; |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)); |
| 210 | if (foreign_ok) { |
| 211 | if (is_inet_addr(&bind_addr)) { |
| 212 | ret = bind(fd, (struct sockaddr *)&bind_addr, get_addr_len(&bind_addr)); |
| 213 | if (ret < 0) |
| 214 | return 2; |
| 215 | } |
| 216 | } |
| 217 | else { |
| 218 | if (is_inet_addr(local)) { |
| 219 | ret = bind(fd, (struct sockaddr *)local, get_addr_len(local)); |
| 220 | if (ret < 0) |
| 221 | return 1; |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | if (!flags) |
| 226 | return 0; |
| 227 | |
| 228 | if (!foreign_ok) |
| 229 | /* we could not bind to a foreign address */ |
| 230 | return 2; |
| 231 | |
| 232 | return 0; |
| 233 | } |
| 234 | |
| 235 | /* |
| 236 | * This function initiates a QUIC connection establishment to the target assigned |
| 237 | * to connection <conn> using (si->{target,dst}). A source address may be |
| 238 | * pointed to by conn->src in case of transparent proxying. Normal source |
| 239 | * bind addresses are still determined locally (due to the possible need of a |
| 240 | * source port). conn->target may point either to a valid server or to a backend, |
| 241 | * depending on conn->target. Only OBJ_TYPE_PROXY and OBJ_TYPE_SERVER are |
| 242 | * supported. The <data> parameter is a boolean indicating whether there are data |
| 243 | * waiting for being sent or not, in order to adjust data write polling and on |
| 244 | * some platforms, the ability to avoid an empty initial ACK. The <flags> argument |
| 245 | * is not used. |
| 246 | * |
| 247 | * Note that a pending send_proxy message accounts for data. |
| 248 | * |
| 249 | * It can return one of : |
| 250 | * - SF_ERR_NONE if everything's OK |
| 251 | * - SF_ERR_SRVTO if there are no more servers |
| 252 | * - SF_ERR_SRVCL if the connection was refused by the server |
| 253 | * - SF_ERR_PRXCOND if the connection has been limited by the proxy (maxconn) |
| 254 | * - SF_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...) |
| 255 | * - SF_ERR_INTERNAL for any other purely internal errors |
| 256 | * Additionally, in the case of SF_ERR_RESOURCE, an emergency log will be emitted. |
| 257 | * |
| 258 | * The connection's fd is inserted only when SF_ERR_NONE is returned, otherwise |
| 259 | * it's invalid and the caller has nothing to do. |
| 260 | */ |
| 261 | |
| 262 | int quic_connect_server(struct connection *conn, int flags) |
| 263 | { |
| 264 | int fd; |
| 265 | struct server *srv; |
| 266 | struct proxy *be; |
| 267 | struct conn_src *src; |
| 268 | struct sockaddr_storage *addr; |
| 269 | |
Willy Tarreau | 158b6cf | 2022-05-02 17:45:12 +0200 | [diff] [blame] | 270 | BUG_ON(!conn->dst); |
| 271 | |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 272 | conn->flags |= CO_FL_WAIT_L4_CONN; /* connection in progress */ |
| 273 | |
| 274 | switch (obj_type(conn->target)) { |
| 275 | case OBJ_TYPE_PROXY: |
Frédéric Lécaille | e1c3546 | 2022-02-14 19:01:21 +0100 | [diff] [blame] | 276 | be = __objt_proxy(conn->target); |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 277 | srv = NULL; |
| 278 | break; |
| 279 | case OBJ_TYPE_SERVER: |
Frédéric Lécaille | e1c3546 | 2022-02-14 19:01:21 +0100 | [diff] [blame] | 280 | srv = __objt_server(conn->target); |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 281 | be = srv->proxy; |
| 282 | break; |
| 283 | default: |
| 284 | conn->flags |= CO_FL_ERROR; |
| 285 | return SF_ERR_INTERNAL; |
| 286 | } |
| 287 | |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 288 | fd = conn->handle.fd = sock_create_server_socket(conn); |
| 289 | |
| 290 | if (fd == -1) { |
| 291 | qfprintf(stderr, "Cannot get a server socket.\n"); |
| 292 | |
| 293 | if (errno == ENFILE) { |
| 294 | conn->err_code = CO_ER_SYS_FDLIM; |
| 295 | send_log(be, LOG_EMERG, |
| 296 | "Proxy %s reached system FD limit (maxsock=%d). Please check system tunables.\n", |
| 297 | be->id, global.maxsock); |
| 298 | } |
| 299 | else if (errno == EMFILE) { |
| 300 | conn->err_code = CO_ER_PROC_FDLIM; |
| 301 | send_log(be, LOG_EMERG, |
| 302 | "Proxy %s reached process FD limit (maxsock=%d). Please check 'ulimit-n' and restart.\n", |
| 303 | be->id, global.maxsock); |
| 304 | } |
| 305 | else if (errno == ENOBUFS || errno == ENOMEM) { |
| 306 | conn->err_code = CO_ER_SYS_MEMLIM; |
| 307 | send_log(be, LOG_EMERG, |
| 308 | "Proxy %s reached system memory limit (maxsock=%d). Please check system tunables.\n", |
| 309 | be->id, global.maxsock); |
| 310 | } |
| 311 | else if (errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT) { |
| 312 | conn->err_code = CO_ER_NOPROTO; |
| 313 | } |
| 314 | else |
| 315 | conn->err_code = CO_ER_SOCK_ERR; |
| 316 | |
| 317 | /* this is a resource error */ |
| 318 | conn->flags |= CO_FL_ERROR; |
| 319 | return SF_ERR_RESOURCE; |
| 320 | } |
| 321 | |
| 322 | if (fd >= global.maxsock) { |
| 323 | /* do not log anything there, it's a normal condition when this option |
| 324 | * is used to serialize connections to a server ! |
| 325 | */ |
| 326 | ha_alert("socket(): not enough free sockets. Raise -n argument. Giving up.\n"); |
| 327 | close(fd); |
| 328 | conn->err_code = CO_ER_CONF_FDLIM; |
| 329 | conn->flags |= CO_FL_ERROR; |
| 330 | return SF_ERR_PRXCOND; /* it is a configuration limit */ |
| 331 | } |
| 332 | |
Willy Tarreau | 3824743 | 2022-04-26 10:24:14 +0200 | [diff] [blame] | 333 | if (fd_set_nonblock(fd) == -1) { |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 334 | qfprintf(stderr,"Cannot set client socket to non blocking mode.\n"); |
| 335 | close(fd); |
| 336 | conn->err_code = CO_ER_SOCK_ERR; |
| 337 | conn->flags |= CO_FL_ERROR; |
| 338 | return SF_ERR_INTERNAL; |
| 339 | } |
| 340 | |
Willy Tarreau | 3824743 | 2022-04-26 10:24:14 +0200 | [diff] [blame] | 341 | if (master == 1 && fd_set_cloexec(fd) == -1) { |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 342 | ha_alert("Cannot set CLOEXEC on client socket.\n"); |
| 343 | close(fd); |
| 344 | conn->err_code = CO_ER_SOCK_ERR; |
| 345 | conn->flags |= CO_FL_ERROR; |
| 346 | return SF_ERR_INTERNAL; |
| 347 | } |
| 348 | |
| 349 | /* allow specific binding : |
| 350 | * - server-specific at first |
| 351 | * - proxy-specific next |
| 352 | */ |
| 353 | if (srv && srv->conn_src.opts & CO_SRC_BIND) |
| 354 | src = &srv->conn_src; |
| 355 | else if (be->conn_src.opts & CO_SRC_BIND) |
| 356 | src = &be->conn_src; |
| 357 | else |
| 358 | src = NULL; |
| 359 | |
| 360 | if (src) { |
| 361 | int ret, flags = 0; |
| 362 | |
| 363 | if (conn->src && is_inet_addr(conn->src)) { |
| 364 | switch (src->opts & CO_SRC_TPROXY_MASK) { |
| 365 | case CO_SRC_TPROXY_CLI: |
| 366 | conn_set_private(conn); |
| 367 | /* fall through */ |
| 368 | case CO_SRC_TPROXY_ADDR: |
| 369 | flags = 3; |
| 370 | break; |
| 371 | case CO_SRC_TPROXY_CIP: |
| 372 | case CO_SRC_TPROXY_DYN: |
| 373 | conn_set_private(conn); |
| 374 | flags = 1; |
| 375 | break; |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | #ifdef SO_BINDTODEVICE |
| 380 | /* Note: this might fail if not CAP_NET_RAW */ |
| 381 | if (src->iface_name) |
| 382 | setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, src->iface_name, src->iface_len + 1); |
| 383 | #endif |
| 384 | |
| 385 | if (src->sport_range) { |
| 386 | int attempts = 10; /* should be more than enough to find a spare port */ |
| 387 | struct sockaddr_storage sa; |
| 388 | |
| 389 | ret = 1; |
| 390 | memcpy(&sa, &src->source_addr, sizeof(sa)); |
| 391 | |
| 392 | do { |
| 393 | /* note: in case of retry, we may have to release a previously |
| 394 | * allocated port, hence this loop's construct. |
| 395 | */ |
| 396 | port_range_release_port(fdinfo[fd].port_range, fdinfo[fd].local_port); |
| 397 | fdinfo[fd].port_range = NULL; |
| 398 | |
| 399 | if (!attempts) |
| 400 | break; |
| 401 | attempts--; |
| 402 | |
| 403 | fdinfo[fd].local_port = port_range_alloc_port(src->sport_range); |
| 404 | if (!fdinfo[fd].local_port) { |
| 405 | conn->err_code = CO_ER_PORT_RANGE; |
| 406 | break; |
| 407 | } |
| 408 | |
| 409 | fdinfo[fd].port_range = src->sport_range; |
| 410 | set_host_port(&sa, fdinfo[fd].local_port); |
| 411 | |
| 412 | ret = quic_bind_socket(fd, flags, &sa, conn->src); |
| 413 | if (ret != 0) |
| 414 | conn->err_code = CO_ER_CANT_BIND; |
| 415 | } while (ret != 0); /* binding NOK */ |
| 416 | } |
| 417 | else { |
| 418 | #ifdef IP_BIND_ADDRESS_NO_PORT |
| 419 | static THREAD_LOCAL int bind_address_no_port = 1; |
Willy Tarreau | 4bfc663 | 2021-03-31 08:45:47 +0200 | [diff] [blame] | 420 | setsockopt(fd, IPPROTO_IP, IP_BIND_ADDRESS_NO_PORT, (const void *) &bind_address_no_port, sizeof(int)); |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 421 | #endif |
| 422 | ret = quic_bind_socket(fd, flags, &src->source_addr, conn->src); |
| 423 | if (ret != 0) |
| 424 | conn->err_code = CO_ER_CANT_BIND; |
| 425 | } |
| 426 | |
| 427 | if (unlikely(ret != 0)) { |
| 428 | port_range_release_port(fdinfo[fd].port_range, fdinfo[fd].local_port); |
| 429 | fdinfo[fd].port_range = NULL; |
| 430 | close(fd); |
| 431 | |
| 432 | if (ret == 1) { |
| 433 | ha_alert("Cannot bind to source address before connect() for backend %s. Aborting.\n", |
| 434 | be->id); |
| 435 | send_log(be, LOG_EMERG, |
| 436 | "Cannot bind to source address before connect() for backend %s.\n", |
| 437 | be->id); |
| 438 | } else { |
| 439 | ha_alert("Cannot bind to tproxy source address before connect() for backend %s. Aborting.\n", |
| 440 | be->id); |
| 441 | send_log(be, LOG_EMERG, |
| 442 | "Cannot bind to tproxy source address before connect() for backend %s.\n", |
| 443 | be->id); |
| 444 | } |
| 445 | conn->flags |= CO_FL_ERROR; |
| 446 | return SF_ERR_RESOURCE; |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | if (global.tune.server_sndbuf) |
| 451 | setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &global.tune.server_sndbuf, sizeof(global.tune.server_sndbuf)); |
| 452 | |
| 453 | if (global.tune.server_rcvbuf) |
| 454 | setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &global.tune.server_rcvbuf, sizeof(global.tune.server_rcvbuf)); |
| 455 | |
| 456 | addr = (conn->flags & CO_FL_SOCKS4) ? &srv->socks4_addr : conn->dst; |
| 457 | if (connect(fd, (const struct sockaddr *)addr, get_addr_len(addr)) == -1) { |
| 458 | if (errno == EINPROGRESS || errno == EALREADY) { |
| 459 | /* common case, let's wait for connect status */ |
| 460 | conn->flags |= CO_FL_WAIT_L4_CONN; |
| 461 | } |
| 462 | else if (errno == EISCONN) { |
| 463 | /* should normally not happen but if so, indicates that it's OK */ |
| 464 | conn->flags &= ~CO_FL_WAIT_L4_CONN; |
| 465 | } |
Willy Tarreau | acef5e2 | 2022-04-25 20:32:15 +0200 | [diff] [blame] | 466 | else if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EADDRINUSE || errno == EADDRNOTAVAIL) { |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 467 | char *msg; |
Willy Tarreau | acef5e2 | 2022-04-25 20:32:15 +0200 | [diff] [blame] | 468 | if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EADDRNOTAVAIL) { |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 469 | msg = "no free ports"; |
| 470 | conn->err_code = CO_ER_FREE_PORTS; |
| 471 | } |
| 472 | else { |
| 473 | msg = "local address already in use"; |
| 474 | conn->err_code = CO_ER_ADDR_INUSE; |
| 475 | } |
| 476 | |
| 477 | qfprintf(stderr,"Connect() failed for backend %s: %s.\n", be->id, msg); |
| 478 | port_range_release_port(fdinfo[fd].port_range, fdinfo[fd].local_port); |
| 479 | fdinfo[fd].port_range = NULL; |
| 480 | close(fd); |
| 481 | send_log(be, LOG_ERR, "Connect() failed for backend %s: %s.\n", be->id, msg); |
| 482 | conn->flags |= CO_FL_ERROR; |
| 483 | return SF_ERR_RESOURCE; |
| 484 | } else if (errno == ETIMEDOUT) { |
| 485 | //qfprintf(stderr,"Connect(): ETIMEDOUT"); |
| 486 | port_range_release_port(fdinfo[fd].port_range, fdinfo[fd].local_port); |
| 487 | fdinfo[fd].port_range = NULL; |
| 488 | close(fd); |
| 489 | conn->err_code = CO_ER_SOCK_ERR; |
| 490 | conn->flags |= CO_FL_ERROR; |
| 491 | return SF_ERR_SRVTO; |
| 492 | } else { |
| 493 | // (errno == ECONNREFUSED || errno == ENETUNREACH || errno == EACCES || errno == EPERM) |
| 494 | //qfprintf(stderr,"Connect(): %d", errno); |
| 495 | port_range_release_port(fdinfo[fd].port_range, fdinfo[fd].local_port); |
| 496 | fdinfo[fd].port_range = NULL; |
| 497 | close(fd); |
| 498 | conn->err_code = CO_ER_SOCK_ERR; |
| 499 | conn->flags |= CO_FL_ERROR; |
| 500 | return SF_ERR_SRVCL; |
| 501 | } |
| 502 | } |
| 503 | else { |
| 504 | /* connect() == 0, this is great! */ |
| 505 | conn->flags &= ~CO_FL_WAIT_L4_CONN; |
| 506 | } |
| 507 | |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 508 | conn_ctrl_init(conn); /* registers the FD */ |
Willy Tarreau | b41a6e9 | 2021-04-06 17:49:19 +0200 | [diff] [blame] | 509 | HA_ATOMIC_OR(&fdtab[fd].state, FD_LINGER_RISK); /* close hard if needed */ |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 510 | |
| 511 | if (conn->flags & CO_FL_WAIT_L4_CONN) { |
| 512 | fd_want_send(fd); |
| 513 | fd_cant_send(fd); |
| 514 | fd_cant_recv(fd); |
| 515 | } |
| 516 | |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 517 | return SF_ERR_NONE; /* connection is OK */ |
| 518 | } |
| 519 | |
Frédéric Lécaille | 884f2e9 | 2020-11-23 14:23:21 +0100 | [diff] [blame] | 520 | /* Add listener <listener> to protocol <proto>. Technically speaking we just |
| 521 | * initialize a few entries which should be doable during quic_bind_listener(). |
| 522 | * The end of the initialization goes on with the default function. |
| 523 | */ |
| 524 | static void quic_add_listener(struct protocol *proto, struct listener *listener) |
| 525 | { |
Amaury Denoyelle | b59b889 | 2022-01-25 17:48:47 +0100 | [diff] [blame] | 526 | listener->flags |= LI_F_QUIC_LISTENER; |
Amaury Denoyelle | 683b5fc | 2022-01-26 11:56:48 +0100 | [diff] [blame] | 527 | listener->rx.flags |= RX_F_LOCAL_ACCEPT; |
Amaury Denoyelle | 2ce99fe | 2022-01-19 15:46:11 +0100 | [diff] [blame] | 528 | |
Frédéric Lécaille | 884f2e9 | 2020-11-23 14:23:21 +0100 | [diff] [blame] | 529 | default_add_listener(proto, listener); |
| 530 | } |
| 531 | |
Frédéric Lécaille | 48f8e19 | 2021-07-06 15:39:26 +0200 | [diff] [blame] | 532 | /* Allocate the TX ring buffers for <l> listener. |
| 533 | * Return 1 if succeeded, 0 if not. |
| 534 | */ |
Frédéric Lécaille | c1029f6 | 2021-10-20 11:09:58 +0200 | [diff] [blame] | 535 | static int quic_alloc_tx_rings_listener(struct listener *l) |
Frédéric Lécaille | 48f8e19 | 2021-07-06 15:39:26 +0200 | [diff] [blame] | 536 | { |
| 537 | struct qring *qr; |
| 538 | int i; |
| 539 | |
Frédéric Lécaille | c1029f6 | 2021-10-20 11:09:58 +0200 | [diff] [blame] | 540 | l->rx.tx_qrings = calloc(global.nbthread, sizeof *l->rx.tx_qrings); |
| 541 | if (!l->rx.tx_qrings) |
Frédéric Lécaille | 48f8e19 | 2021-07-06 15:39:26 +0200 | [diff] [blame] | 542 | return 0; |
| 543 | |
Frédéric Lécaille | c1029f6 | 2021-10-20 11:09:58 +0200 | [diff] [blame] | 544 | MT_LIST_INIT(&l->rx.tx_qring_list); |
Frédéric Lécaille | 48f8e19 | 2021-07-06 15:39:26 +0200 | [diff] [blame] | 545 | for (i = 0; i < global.nbthread; i++) { |
Frédéric Lécaille | 8b19a9f | 2021-08-04 15:10:32 +0200 | [diff] [blame] | 546 | unsigned char *buf; |
Frédéric Lécaille | 794d068 | 2022-01-27 10:23:31 +0100 | [diff] [blame] | 547 | struct qring *qr; |
| 548 | |
| 549 | qr = calloc(1, sizeof *qr); |
| 550 | if (!qr) |
| 551 | goto err; |
Frédéric Lécaille | 48f8e19 | 2021-07-06 15:39:26 +0200 | [diff] [blame] | 552 | |
Frédéric Lécaille | 8b19a9f | 2021-08-04 15:10:32 +0200 | [diff] [blame] | 553 | buf = pool_alloc(pool_head_quic_tx_ring); |
Frédéric Lécaille | 794d068 | 2022-01-27 10:23:31 +0100 | [diff] [blame] | 554 | if (!buf) { |
| 555 | free(qr); |
Frédéric Lécaille | 48f8e19 | 2021-07-06 15:39:26 +0200 | [diff] [blame] | 556 | goto err; |
Frédéric Lécaille | 794d068 | 2022-01-27 10:23:31 +0100 | [diff] [blame] | 557 | } |
Frédéric Lécaille | 48f8e19 | 2021-07-06 15:39:26 +0200 | [diff] [blame] | 558 | |
Frédéric Lécaille | 8b19a9f | 2021-08-04 15:10:32 +0200 | [diff] [blame] | 559 | qr->cbuf = cbuf_new(buf, QUIC_TX_RING_BUFSZ); |
| 560 | if (!qr->cbuf) { |
| 561 | pool_free(pool_head_quic_tx_ring, buf); |
Frédéric Lécaille | 794d068 | 2022-01-27 10:23:31 +0100 | [diff] [blame] | 562 | free(qr); |
Frédéric Lécaille | 8b19a9f | 2021-08-04 15:10:32 +0200 | [diff] [blame] | 563 | goto err; |
| 564 | } |
| 565 | |
Frédéric Lécaille | 794d068 | 2022-01-27 10:23:31 +0100 | [diff] [blame] | 566 | l->rx.tx_qrings[i] = qr; |
Frédéric Lécaille | c1029f6 | 2021-10-20 11:09:58 +0200 | [diff] [blame] | 567 | MT_LIST_APPEND(&l->rx.tx_qring_list, &qr->mt_list); |
Frédéric Lécaille | 48f8e19 | 2021-07-06 15:39:26 +0200 | [diff] [blame] | 568 | } |
| 569 | |
| 570 | return 1; |
| 571 | |
| 572 | err: |
Frédéric Lécaille | c1029f6 | 2021-10-20 11:09:58 +0200 | [diff] [blame] | 573 | while ((qr = MT_LIST_POP(&l->rx.tx_qring_list, typeof(qr), mt_list))) { |
Frédéric Lécaille | 8b19a9f | 2021-08-04 15:10:32 +0200 | [diff] [blame] | 574 | pool_free(pool_head_quic_tx_ring, qr->cbuf->buf); |
Frédéric Lécaille | 48f8e19 | 2021-07-06 15:39:26 +0200 | [diff] [blame] | 575 | cbuf_free(qr->cbuf); |
Frédéric Lécaille | 794d068 | 2022-01-27 10:23:31 +0100 | [diff] [blame] | 576 | free(qr); |
Frédéric Lécaille | 8b19a9f | 2021-08-04 15:10:32 +0200 | [diff] [blame] | 577 | } |
Frédéric Lécaille | c1029f6 | 2021-10-20 11:09:58 +0200 | [diff] [blame] | 578 | free(l->rx.tx_qrings); |
Frédéric Lécaille | 48f8e19 | 2021-07-06 15:39:26 +0200 | [diff] [blame] | 579 | return 0; |
| 580 | } |
| 581 | |
Frédéric Lécaille | c1029f6 | 2021-10-20 11:09:58 +0200 | [diff] [blame] | 582 | /* Allocate the RX buffers for <l> listener. |
| 583 | * Return 1 if succeeded, 0 if not. |
| 584 | */ |
| 585 | static int quic_alloc_rxbufs_listener(struct listener *l) |
| 586 | { |
| 587 | int i; |
| 588 | struct rxbuf *rxbuf; |
| 589 | |
| 590 | l->rx.rxbufs = calloc(global.nbthread, sizeof *l->rx.rxbufs); |
| 591 | if (!l->rx.rxbufs) |
| 592 | return 0; |
| 593 | |
| 594 | MT_LIST_INIT(&l->rx.rxbuf_list); |
| 595 | for (i = 0; i < global.nbthread; i++) { |
| 596 | char *buf; |
Frédéric Lécaille | 794d068 | 2022-01-27 10:23:31 +0100 | [diff] [blame] | 597 | struct rxbuf *rxbuf; |
| 598 | |
| 599 | rxbuf = calloc(1, sizeof *rxbuf); |
| 600 | if (!rxbuf) |
| 601 | goto err; |
Frédéric Lécaille | c1029f6 | 2021-10-20 11:09:58 +0200 | [diff] [blame] | 602 | |
Frédéric Lécaille | c1029f6 | 2021-10-20 11:09:58 +0200 | [diff] [blame] | 603 | buf = pool_alloc(pool_head_quic_rxbuf); |
Frédéric Lécaille | 794d068 | 2022-01-27 10:23:31 +0100 | [diff] [blame] | 604 | if (!buf) { |
| 605 | free(rxbuf); |
Frédéric Lécaille | c1029f6 | 2021-10-20 11:09:58 +0200 | [diff] [blame] | 606 | goto err; |
Frédéric Lécaille | 794d068 | 2022-01-27 10:23:31 +0100 | [diff] [blame] | 607 | } |
| 608 | |
| 609 | l->rx.rxbufs[i] = rxbuf; |
Frédéric Lécaille | c1029f6 | 2021-10-20 11:09:58 +0200 | [diff] [blame] | 610 | |
| 611 | rxbuf->buf = b_make(buf, QUIC_RX_BUFSZ, 0, 0); |
Frédéric Lécaille | 53898bb | 2022-01-26 15:55:21 +0100 | [diff] [blame] | 612 | LIST_INIT(&rxbuf->dgrams); |
Frédéric Lécaille | c1029f6 | 2021-10-20 11:09:58 +0200 | [diff] [blame] | 613 | MT_LIST_APPEND(&l->rx.rxbuf_list, &rxbuf->mt_list); |
| 614 | } |
| 615 | |
| 616 | return 1; |
| 617 | |
| 618 | err: |
Frédéric Lécaille | 794d068 | 2022-01-27 10:23:31 +0100 | [diff] [blame] | 619 | while ((rxbuf = MT_LIST_POP(&l->rx.rxbuf_list, typeof(rxbuf), mt_list))) { |
Frédéric Lécaille | c1029f6 | 2021-10-20 11:09:58 +0200 | [diff] [blame] | 620 | pool_free(pool_head_quic_rxbuf, rxbuf->buf.area); |
Frédéric Lécaille | 794d068 | 2022-01-27 10:23:31 +0100 | [diff] [blame] | 621 | free(rxbuf); |
| 622 | } |
Frédéric Lécaille | c1029f6 | 2021-10-20 11:09:58 +0200 | [diff] [blame] | 623 | free(l->rx.rxbufs); |
| 624 | return 0; |
| 625 | } |
| 626 | |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 627 | /* This function tries to bind a QUIC4/6 listener. It may return a warning or |
| 628 | * an error message in <errmsg> if the message is at most <errlen> bytes long |
| 629 | * (including '\0'). Note that <errmsg> may be NULL if <errlen> is also zero. |
| 630 | * The return value is composed from ERR_ABORT, ERR_WARN, |
| 631 | * ERR_ALERT, ERR_RETRYABLE and ERR_FATAL. ERR_NONE indicates that everything |
| 632 | * was alright and that no message was returned. ERR_RETRYABLE means that an |
| 633 | * error occurred but that it may vanish after a retry (eg: port in use), and |
| 634 | * ERR_FATAL indicates a non-fixable error. ERR_WARN and ERR_ALERT do not alter |
| 635 | * the meaning of the error, but just indicate that a message is present which |
| 636 | * should be displayed with the respective level. Last, ERR_ABORT indicates |
| 637 | * that it's pointless to try to start other listeners. No error message is |
| 638 | * returned if errlen is NULL. |
| 639 | */ |
| 640 | static int quic_bind_listener(struct listener *listener, char *errmsg, int errlen) |
| 641 | { |
| 642 | int err = ERR_NONE; |
| 643 | char *msg = NULL; |
| 644 | |
| 645 | /* ensure we never return garbage */ |
| 646 | if (errlen) |
| 647 | *errmsg = 0; |
| 648 | |
| 649 | if (listener->state != LI_ASSIGNED) |
| 650 | return ERR_NONE; /* already bound */ |
| 651 | |
| 652 | if (!(listener->rx.flags & RX_F_BOUND)) { |
| 653 | msg = "receiving socket not bound"; |
| 654 | goto udp_return; |
| 655 | } |
| 656 | |
Frédéric Lécaille | c1029f6 | 2021-10-20 11:09:58 +0200 | [diff] [blame] | 657 | if (!quic_alloc_tx_rings_listener(listener) || |
Amaury Denoyelle | 8524f0f | 2022-02-08 15:03:40 +0100 | [diff] [blame] | 658 | !quic_alloc_rxbufs_listener(listener)) { |
| 659 | msg = "could not initialize tx/rx rings"; |
Frédéric Lécaille | 48f8e19 | 2021-07-06 15:39:26 +0200 | [diff] [blame] | 660 | err |= ERR_WARN; |
| 661 | goto udp_return; |
| 662 | } |
| 663 | |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 664 | listener_set_state(listener, LI_LISTEN); |
| 665 | |
| 666 | udp_return: |
| 667 | if (msg && errlen) { |
| 668 | char pn[INET6_ADDRSTRLEN]; |
| 669 | |
| 670 | addr_to_str(&listener->rx.addr, pn, sizeof(pn)); |
Willy Tarreau | 6823a3a | 2021-10-14 11:59:15 +0200 | [diff] [blame] | 671 | snprintf(errmsg, errlen, "%s for [%s:%d]", msg, pn, get_host_port(&listener->rx.addr)); |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 672 | } |
| 673 | return err; |
| 674 | } |
| 675 | |
| 676 | /* Enable receipt of incoming connections for listener <l>. The receiver must |
| 677 | * still be valid. Does nothing in early boot (needs fd_updt). |
| 678 | */ |
| 679 | static void quic_enable_listener(struct listener *l) |
| 680 | { |
| 681 | /* FIXME: The following statements are incorrect. This |
Ilya Shipitsin | b8888ab | 2021-01-06 21:20:16 +0500 | [diff] [blame] | 682 | * is the responsibility of the QUIC xprt to stop accepting new |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 683 | * connections. |
| 684 | */ |
| 685 | if (fd_updt) |
| 686 | fd_want_recv(l->rx.fd); |
| 687 | } |
| 688 | |
| 689 | /* Disable receipt of incoming connections for listener <l>. The receiver must |
| 690 | * still be valid. Does nothing in early boot (needs fd_updt). |
| 691 | */ |
| 692 | static void quic_disable_listener(struct listener *l) |
| 693 | { |
| 694 | /* FIXME: The following statements are incorrect. This |
Ilya Shipitsin | b8888ab | 2021-01-06 21:20:16 +0500 | [diff] [blame] | 695 | * is the responsibility of the QUIC xprt to start accepting new |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 696 | * connections again. |
| 697 | */ |
| 698 | if (fd_updt) |
| 699 | fd_stop_recv(l->rx.fd); |
| 700 | } |
Amaury Denoyelle | 8524f0f | 2022-02-08 15:03:40 +0100 | [diff] [blame] | 701 | |
| 702 | static int quic_alloc_dghdlrs(void) |
| 703 | { |
| 704 | int i; |
| 705 | |
Tim Duesterhus | 9fb57e8 | 2022-06-01 21:58:37 +0200 | [diff] [blame] | 706 | quic_dghdlrs = calloc(global.nbthread, sizeof(*quic_dghdlrs)); |
Amaury Denoyelle | 8524f0f | 2022-02-08 15:03:40 +0100 | [diff] [blame] | 707 | if (!quic_dghdlrs) { |
| 708 | ha_alert("Failed to allocate the quic datagram handlers.\n"); |
| 709 | return 0; |
| 710 | } |
| 711 | |
| 712 | for (i = 0; i < global.nbthread; i++) { |
| 713 | struct quic_dghdlr *dghdlr = &quic_dghdlrs[i]; |
| 714 | |
| 715 | dghdlr->task = tasklet_new(); |
| 716 | if (!dghdlr->task) { |
| 717 | ha_alert("Failed to allocate the quic datagram handler on thread %d.\n", i); |
| 718 | return 0; |
| 719 | } |
| 720 | |
| 721 | tasklet_set_tid(dghdlr->task, i); |
| 722 | dghdlr->task->context = dghdlr; |
| 723 | dghdlr->task->process = quic_lstnr_dghdlr; |
| 724 | |
| 725 | dghdlr->odcids = EB_ROOT_UNIQUE; |
| 726 | dghdlr->cids = EB_ROOT_UNIQUE; |
| 727 | |
| 728 | MT_LIST_INIT(&dghdlr->dgrams); |
| 729 | } |
| 730 | |
| 731 | return 1; |
| 732 | } |
| 733 | REGISTER_POST_CHECK(quic_alloc_dghdlrs); |
| 734 | |
| 735 | static int quic_deallocate_dghdlrs(void) |
| 736 | { |
| 737 | int i; |
| 738 | |
| 739 | if (quic_dghdlrs) { |
| 740 | for (i = 0; i < global.nbthread; ++i) |
| 741 | tasklet_free(quic_dghdlrs[i].task); |
| 742 | free(quic_dghdlrs); |
| 743 | } |
| 744 | |
| 745 | return 1; |
| 746 | } |
| 747 | REGISTER_POST_DEINIT(quic_deallocate_dghdlrs); |
Frédéric Lécaille | ca42b2c | 2020-11-02 14:27:08 +0100 | [diff] [blame] | 748 | |
| 749 | /* |
| 750 | * Local variables: |
| 751 | * c-indent-level: 8 |
| 752 | * c-basic-offset: 8 |
| 753 | * End: |
| 754 | */ |