Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 1 | /* |
Willy Tarreau | 03fa5df | 2010-05-24 21:02:37 +0200 | [diff] [blame] | 2 | * Frontend variables and functions. |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 3 | * |
Willy Tarreau | 03fa5df | 2010-05-24 21:02:37 +0200 | [diff] [blame] | 4 | * Copyright 2000-2010 Willy Tarreau <w@1wt.eu> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [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 <errno.h> |
| 14 | #include <fcntl.h> |
| 15 | #include <stdio.h> |
| 16 | #include <stdlib.h> |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 17 | #include <string.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 18 | |
| 19 | #include <sys/socket.h> |
| 20 | #include <sys/stat.h> |
| 21 | #include <sys/types.h> |
| 22 | |
Willy Tarreau | 48a7e72 | 2010-12-24 15:26:39 +0100 | [diff] [blame] | 23 | #include <netinet/tcp.h> |
| 24 | |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 25 | #include <common/compat.h> |
Willy Tarreau | e3ba5f0 | 2006-06-29 18:54:54 +0200 | [diff] [blame] | 26 | #include <common/config.h> |
Willy Tarreau | 8b0cbf9 | 2010-10-15 23:23:19 +0200 | [diff] [blame] | 27 | #include <common/debug.h> |
| 28 | #include <common/standard.h> |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 29 | #include <common/time.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 30 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 31 | #include <types/global.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 32 | |
Willy Tarreau | 8797c06 | 2007-05-07 00:55:35 +0200 | [diff] [blame] | 33 | #include <proto/acl.h> |
Willy Tarreau | 5446940 | 2006-07-29 16:59:06 +0200 | [diff] [blame] | 34 | #include <proto/buffers.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 35 | #include <proto/fd.h> |
Willy Tarreau | 03fa5df | 2010-05-24 21:02:37 +0200 | [diff] [blame] | 36 | #include <proto/frontend.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 37 | #include <proto/log.h> |
Willy Tarreau | e5f20dc | 2006-12-03 15:21:35 +0100 | [diff] [blame] | 38 | #include <proto/hdr_idx.h> |
Willy Tarreau | 9650f37 | 2009-08-16 14:02:45 +0200 | [diff] [blame] | 39 | #include <proto/proto_tcp.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 40 | #include <proto/proto_http.h> |
Willy Tarreau | 7f062c4 | 2009-03-05 18:43:00 +0100 | [diff] [blame] | 41 | #include <proto/proxy.h> |
Willy Tarreau | c6ca1a0 | 2007-05-13 19:43:47 +0200 | [diff] [blame] | 42 | #include <proto/session.h> |
Willy Tarreau | dded32d | 2008-11-30 19:48:07 +0100 | [diff] [blame] | 43 | #include <proto/stream_interface.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 44 | #include <proto/stream_sock.h> |
| 45 | #include <proto/task.h> |
| 46 | |
| 47 | |
Willy Tarreau | 14c8aac | 2007-05-08 19:46:30 +0200 | [diff] [blame] | 48 | /* Retrieves the original destination address used by the client, and sets the |
| 49 | * SN_FRT_ADDR_SET flag. |
| 50 | */ |
| 51 | void get_frt_addr(struct session *s) |
| 52 | { |
| 53 | socklen_t namelen = sizeof(s->frt_addr); |
| 54 | |
Willy Tarreau | 7e5067d | 2008-12-07 16:27:56 +0100 | [diff] [blame] | 55 | if (get_original_dst(s->si[0].fd, (struct sockaddr_in *)&s->frt_addr, &namelen) == -1) |
| 56 | getsockname(s->si[0].fd, (struct sockaddr *)&s->frt_addr, &namelen); |
Willy Tarreau | 14c8aac | 2007-05-08 19:46:30 +0200 | [diff] [blame] | 57 | s->flags |= SN_FRT_ADDR_SET; |
| 58 | } |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 59 | |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 60 | /* Finish a session accept() for a proxy (TCP or HTTP). It returns a negative |
Willy Tarreau | abe8ea5 | 2010-11-11 10:56:04 +0100 | [diff] [blame] | 61 | * value in case of a critical failure which must cause the listener to be |
| 62 | * disabled, a positive value in case of success, or zero if it is a success |
| 63 | * but the session must be closed ASAP (eg: monitoring). |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 64 | */ |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 65 | int frontend_accept(struct session *s) |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 66 | { |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 67 | int cfd = s->si[0].fd; |
Emeric Brun | b982a3d | 2010-01-04 15:45:53 +0100 | [diff] [blame] | 68 | |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 69 | tv_zero(&s->logs.tv_request); |
| 70 | s->logs.t_queue = -1; |
| 71 | s->logs.t_connect = -1; |
| 72 | s->logs.t_data = -1; |
| 73 | s->logs.t_close = 0; |
| 74 | s->logs.bytes_in = s->logs.bytes_out = 0; |
| 75 | s->logs.prx_queue_size = 0; /* we get the number of pending conns before us */ |
| 76 | s->logs.srv_queue_size = 0; /* we will get this number soon */ |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 77 | |
Willy Tarreau | 35a0994 | 2010-06-01 17:12:40 +0200 | [diff] [blame] | 78 | s->data_state = DATA_ST_INIT; |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 79 | s->data_source = DATA_SRC_NONE; |
Willy Tarreau | a5555ec | 2008-11-30 19:02:32 +0100 | [diff] [blame] | 80 | |
Willy Tarreau | 35a0994 | 2010-06-01 17:12:40 +0200 | [diff] [blame] | 81 | /* FIXME: the logs are horribly complicated now, because they are |
| 82 | * defined in <p>, <p>, and later <be> and <be>. |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 83 | */ |
Willy Tarreau | 35a0994 | 2010-06-01 17:12:40 +0200 | [diff] [blame] | 84 | if (s->logs.logwait & LW_REQ) |
| 85 | s->do_log = http_sess_log; |
| 86 | else |
| 87 | s->do_log = tcp_sess_log; |
| 88 | |
| 89 | /* default error reporting function, may be changed by analysers */ |
| 90 | s->srv_error = default_srv_error; |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 91 | |
Willy Tarreau | f67c978 | 2010-05-23 22:59:00 +0200 | [diff] [blame] | 92 | /* Adjust some socket options */ |
Willy Tarreau | 9c3bc22 | 2010-12-24 14:49:37 +0100 | [diff] [blame] | 93 | if (s->listener->addr.ss_family == AF_INET || s->listener->addr.ss_family == AF_INET6) { |
| 94 | if (setsockopt(cfd, IPPROTO_TCP, TCP_NODELAY, |
| 95 | (char *) &one, sizeof(one)) == -1) |
| 96 | goto out_return; |
Willy Tarreau | f67c978 | 2010-05-23 22:59:00 +0200 | [diff] [blame] | 97 | |
Willy Tarreau | 9c3bc22 | 2010-12-24 14:49:37 +0100 | [diff] [blame] | 98 | if (s->fe->options & PR_O_TCP_CLI_KA) |
| 99 | setsockopt(cfd, SOL_SOCKET, SO_KEEPALIVE, |
| 100 | (char *) &one, sizeof(one)); |
Willy Tarreau | f67c978 | 2010-05-23 22:59:00 +0200 | [diff] [blame] | 101 | |
Willy Tarreau | 9c3bc22 | 2010-12-24 14:49:37 +0100 | [diff] [blame] | 102 | if (s->fe->options & PR_O_TCP_NOLING) |
| 103 | setsockopt(cfd, SOL_SOCKET, SO_LINGER, |
| 104 | (struct linger *) &nolinger, sizeof(struct linger)); |
Willy Tarreau | 48a7e72 | 2010-12-24 15:26:39 +0100 | [diff] [blame] | 105 | #if defined(TCP_MAXSEG) |
| 106 | if (s->listener->maxseg < 0) { |
| 107 | /* we just want to reduce the current MSS by that value */ |
| 108 | int mss; |
Willy Tarreau | 7d286a0 | 2011-01-05 15:42:54 +0100 | [diff] [blame^] | 109 | socklen_t mss_len = sizeof(mss); |
Willy Tarreau | 48a7e72 | 2010-12-24 15:26:39 +0100 | [diff] [blame] | 110 | if (getsockopt(cfd, IPPROTO_TCP, TCP_MAXSEG, &mss, &mss_len) == 0) { |
| 111 | mss += s->listener->maxseg; /* remember, it's < 0 */ |
| 112 | setsockopt(cfd, IPPROTO_TCP, TCP_MAXSEG, &mss, sizeof(mss)); |
| 113 | } |
| 114 | } |
| 115 | #endif |
Willy Tarreau | 9c3bc22 | 2010-12-24 14:49:37 +0100 | [diff] [blame] | 116 | } |
Willy Tarreau | f67c978 | 2010-05-23 22:59:00 +0200 | [diff] [blame] | 117 | |
| 118 | if (global.tune.client_sndbuf) |
| 119 | setsockopt(cfd, SOL_SOCKET, SO_SNDBUF, &global.tune.client_sndbuf, sizeof(global.tune.client_sndbuf)); |
| 120 | |
| 121 | if (global.tune.client_rcvbuf) |
| 122 | setsockopt(cfd, SOL_SOCKET, SO_RCVBUF, &global.tune.client_rcvbuf, sizeof(global.tune.client_rcvbuf)); |
| 123 | |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 124 | if (s->fe->mode == PR_MODE_HTTP) { |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 125 | /* the captures are only used in HTTP frontends */ |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 126 | if (unlikely(s->fe->nb_req_cap > 0 && |
| 127 | (s->txn.req.cap = pool_alloc2(s->fe->req_cap_pool)) == NULL)) |
Willy Tarreau | abe8ea5 | 2010-11-11 10:56:04 +0100 | [diff] [blame] | 128 | goto out_return; /* no memory */ |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 129 | |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 130 | if (unlikely(s->fe->nb_rsp_cap > 0 && |
| 131 | (s->txn.rsp.cap = pool_alloc2(s->fe->rsp_cap_pool)) == NULL)) |
Willy Tarreau | 35a0994 | 2010-06-01 17:12:40 +0200 | [diff] [blame] | 132 | goto out_free_reqcap; /* no memory */ |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 133 | } |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 134 | |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 135 | if (s->fe->acl_requires & ACL_USE_L7_ANY) { |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 136 | /* we have to allocate header indexes only if we know |
| 137 | * that we may make use of them. This of course includes |
| 138 | * (mode == PR_MODE_HTTP). |
Willy Tarreau | 042cc79 | 2007-03-19 16:20:06 +0100 | [diff] [blame] | 139 | */ |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 140 | s->txn.hdr_idx.size = MAX_HTTP_HDR; |
Willy Tarreau | 45e73e3 | 2006-12-17 00:05:15 +0100 | [diff] [blame] | 141 | |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 142 | if (unlikely((s->txn.hdr_idx.v = pool_alloc2(s->fe->hdr_idx_pool)) == NULL)) |
Willy Tarreau | 35a0994 | 2010-06-01 17:12:40 +0200 | [diff] [blame] | 143 | goto out_free_rspcap; /* no memory */ |
Willy Tarreau | 45e73e3 | 2006-12-17 00:05:15 +0100 | [diff] [blame] | 144 | |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 145 | /* and now initialize the HTTP transaction state */ |
| 146 | http_init_txn(s); |
| 147 | } |
Willy Tarreau | e5f20dc | 2006-12-03 15:21:35 +0100 | [diff] [blame] | 148 | |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 149 | if ((s->fe->mode == PR_MODE_TCP || s->fe->mode == PR_MODE_HTTP) |
| 150 | && (s->fe->logfac1 >= 0 || s->fe->logfac2 >= 0)) { |
| 151 | if (likely(s->fe->to_log)) { |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 152 | /* we have the client ip */ |
| 153 | if (s->logs.logwait & LW_CLIP) |
| 154 | if (!(s->logs.logwait &= ~LW_CLIP)) |
| 155 | s->do_log(s); |
Willy Tarreau | a3445fc | 2010-05-20 16:17:07 +0200 | [diff] [blame] | 156 | } |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 157 | else if (s->cli_addr.ss_family == AF_INET) { |
| 158 | char pn[INET_ADDRSTRLEN], sn[INET_ADDRSTRLEN]; |
Willy Tarreau | 14c8aac | 2007-05-08 19:46:30 +0200 | [diff] [blame] | 159 | |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 160 | if (!(s->flags & SN_FRT_ADDR_SET)) |
| 161 | get_frt_addr(s); |
Willy Tarreau | 14c8aac | 2007-05-08 19:46:30 +0200 | [diff] [blame] | 162 | |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 163 | if (inet_ntop(AF_INET, (const void *)&((struct sockaddr_in *)&s->frt_addr)->sin_addr, |
| 164 | sn, sizeof(sn)) && |
| 165 | inet_ntop(AF_INET, (const void *)&((struct sockaddr_in *)&s->cli_addr)->sin_addr, |
| 166 | pn, sizeof(pn))) { |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 167 | send_log(s->fe, LOG_INFO, "Connect from %s:%d to %s:%d (%s/%s)\n", |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 168 | pn, ntohs(((struct sockaddr_in *)&s->cli_addr)->sin_port), |
| 169 | sn, ntohs(((struct sockaddr_in *)&s->frt_addr)->sin_port), |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 170 | s->fe->id, (s->fe->mode == PR_MODE_HTTP) ? "HTTP" : "TCP"); |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 171 | } |
| 172 | } |
Emeric Brun | ab844ea | 2010-10-22 16:33:18 +0200 | [diff] [blame] | 173 | else if (s->cli_addr.ss_family == AF_INET6) { |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 174 | char pn[INET6_ADDRSTRLEN], sn[INET6_ADDRSTRLEN]; |
Willy Tarreau | 14c8aac | 2007-05-08 19:46:30 +0200 | [diff] [blame] | 175 | |
| 176 | if (!(s->flags & SN_FRT_ADDR_SET)) |
| 177 | get_frt_addr(s); |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 178 | |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 179 | if (inet_ntop(AF_INET6, (const void *)&((struct sockaddr_in6 *)&s->frt_addr)->sin6_addr, |
| 180 | sn, sizeof(sn)) && |
| 181 | inet_ntop(AF_INET6, (const void *)&((struct sockaddr_in6 *)&s->cli_addr)->sin6_addr, |
| 182 | pn, sizeof(pn))) { |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 183 | send_log(s->fe, LOG_INFO, "Connect from %s:%d to %s:%d (%s/%s)\n", |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 184 | pn, ntohs(((struct sockaddr_in6 *)&s->cli_addr)->sin6_port), |
| 185 | sn, ntohs(((struct sockaddr_in6 *)&s->frt_addr)->sin6_port), |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 186 | s->fe->id, (s->fe->mode == PR_MODE_HTTP) ? "HTTP" : "TCP"); |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 187 | } |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 188 | } |
Emeric Brun | ab844ea | 2010-10-22 16:33:18 +0200 | [diff] [blame] | 189 | else { |
| 190 | /* UNIX socket, only the destination is known */ |
| 191 | send_log(s->fe, LOG_INFO, "Connect to unix:%d (%s/%s)\n", |
| 192 | s->listener->luid, |
| 193 | s->fe->id, (s->fe->mode == PR_MODE_HTTP) ? "HTTP" : "TCP"); |
| 194 | } |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 195 | } |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 196 | |
Willy Tarreau | 2281b7f | 2010-05-28 19:29:49 +0200 | [diff] [blame] | 197 | if (unlikely((global.mode & MODE_DEBUG) && (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)))) { |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 198 | int len; |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 199 | |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 200 | if (!(s->flags & SN_FRT_ADDR_SET)) |
| 201 | get_frt_addr(s); |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 202 | |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 203 | if (s->cli_addr.ss_family == AF_INET) { |
| 204 | char pn[INET_ADDRSTRLEN]; |
| 205 | inet_ntop(AF_INET, |
| 206 | (const void *)&((struct sockaddr_in *)&s->cli_addr)->sin_addr, |
| 207 | pn, sizeof(pn)); |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 208 | |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 209 | len = sprintf(trash, "%08x:%s.accept(%04x)=%04x from [%s:%d]\n", |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 210 | s->uniq_id, s->fe->id, (unsigned short)s->listener->fd, (unsigned short)cfd, |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 211 | pn, ntohs(((struct sockaddr_in *)&s->cli_addr)->sin_port)); |
| 212 | } |
Emeric Brun | ab844ea | 2010-10-22 16:33:18 +0200 | [diff] [blame] | 213 | else if (s->cli_addr.ss_family == AF_INET6) { |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 214 | char pn[INET6_ADDRSTRLEN]; |
| 215 | inet_ntop(AF_INET6, |
| 216 | (const void *)&((struct sockaddr_in6 *)(&s->cli_addr))->sin6_addr, |
| 217 | pn, sizeof(pn)); |
Willy Tarreau | fa7e102 | 2008-10-19 07:30:41 +0200 | [diff] [blame] | 218 | |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 219 | len = sprintf(trash, "%08x:%s.accept(%04x)=%04x from [%s:%d]\n", |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 220 | s->uniq_id, s->fe->id, (unsigned short)s->listener->fd, (unsigned short)cfd, |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 221 | pn, ntohs(((struct sockaddr_in6 *)(&s->cli_addr))->sin6_port)); |
| 222 | } |
Emeric Brun | ab844ea | 2010-10-22 16:33:18 +0200 | [diff] [blame] | 223 | else { |
| 224 | len = sprintf(trash, "%08x:%s.accept(%04x)=%04x from [unix:%d]\n", |
| 225 | s->uniq_id, s->fe->id, (unsigned short)s->listener->fd, (unsigned short)cfd, |
| 226 | s->listener->luid); |
| 227 | } |
Willy Tarreau | 9a2d154 | 2008-08-30 12:31:07 +0200 | [diff] [blame] | 228 | |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 229 | write(1, trash, len); |
| 230 | } |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 231 | |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 232 | if (s->fe->mode == PR_MODE_HTTP) |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 233 | s->req->flags |= BF_READ_DONTWAIT; /* one read is usually enough */ |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 234 | |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 235 | /* note: this should not happen anymore since there's always at least the switching rules */ |
| 236 | if (!s->req->analysers) { |
| 237 | buffer_auto_connect(s->req); /* don't wait to establish connection */ |
| 238 | buffer_auto_close(s->req); /* let the producer forward close requests */ |
| 239 | } |
Willy Tarreau | d797128 | 2006-07-29 18:36:34 +0200 | [diff] [blame] | 240 | |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 241 | s->req->rto = s->fe->timeout.client; |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 242 | s->rep->wto = s->fe->timeout.client; |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 243 | |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 244 | fdtab[cfd].flags = FD_FL_TCP | FD_FL_TCP_NODELAY; |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 245 | if (s->fe->options & PR_O_TCP_NOLING) |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 246 | fdtab[cfd].flags |= FD_FL_TCP_NOLING; |
Willy Tarreau | 6e6fb2b | 2009-08-16 18:20:44 +0200 | [diff] [blame] | 247 | |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 248 | if (unlikely((s->fe->mode == PR_MODE_HTTP && (s->flags & SN_MONITOR)) || |
| 249 | (s->fe->mode == PR_MODE_HEALTH && (s->fe->options & PR_O_HTTP_CHK)))) { |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 250 | /* Either we got a request from a monitoring system on an HTTP instance, |
| 251 | * or we're in health check mode with the 'httpchk' option enabled. In |
| 252 | * both cases, we return a fake "HTTP/1.0 200 OK" response and we exit. |
| 253 | */ |
| 254 | struct chunk msg; |
| 255 | chunk_initstr(&msg, "HTTP/1.0 200 OK\r\n\r\n"); |
| 256 | stream_int_retnclose(&s->si[0], &msg); /* forge a 200 response */ |
| 257 | s->req->analysers = 0; |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 258 | s->task->expire = s->rep->wex; |
Willy Tarreau | 35a0994 | 2010-06-01 17:12:40 +0200 | [diff] [blame] | 259 | EV_FD_CLR(cfd, DIR_RD); |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 260 | } |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 261 | else if (unlikely(s->fe->mode == PR_MODE_HEALTH)) { /* health check mode, no client reading */ |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 262 | struct chunk msg; |
| 263 | chunk_initstr(&msg, "OK\n"); |
| 264 | stream_int_retnclose(&s->si[0], &msg); /* forge an "OK" response */ |
| 265 | s->req->analysers = 0; |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 266 | s->task->expire = s->rep->wex; |
Willy Tarreau | 35a0994 | 2010-06-01 17:12:40 +0200 | [diff] [blame] | 267 | EV_FD_CLR(cfd, DIR_RD); |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 268 | } |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 269 | /* everything's OK, let's go on */ |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 270 | return 1; |
Willy Tarreau | 8ced9a4 | 2007-11-04 17:51:50 +0100 | [diff] [blame] | 271 | |
| 272 | /* Error unrolling */ |
Willy Tarreau | 35a0994 | 2010-06-01 17:12:40 +0200 | [diff] [blame] | 273 | out_free_rspcap: |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 274 | pool_free2(s->fe->rsp_cap_pool, s->txn.rsp.cap); |
Willy Tarreau | 35a0994 | 2010-06-01 17:12:40 +0200 | [diff] [blame] | 275 | out_free_reqcap: |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 276 | pool_free2(s->fe->req_cap_pool, s->txn.req.cap); |
Willy Tarreau | abe8ea5 | 2010-11-11 10:56:04 +0100 | [diff] [blame] | 277 | out_return: |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 278 | return -1; |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 279 | } |
| 280 | |
Willy Tarreau | 8b0cbf9 | 2010-10-15 23:23:19 +0200 | [diff] [blame] | 281 | /* This analyser tries to fetch a line from the request buffer which looks like : |
| 282 | * |
| 283 | * "PROXY" <SP> PROTO <SP> SRC3 <SP> DST3 <SP> SRC4 <SP> <DST4> "\r\n" |
| 284 | * |
| 285 | * There must be exactly one space between each field. Fields are : |
Emeric Brun | 861ccff | 2010-10-29 12:03:03 +0200 | [diff] [blame] | 286 | * - PROTO : layer 4 protocol, which must be "TCP4" or "TCP6". |
Willy Tarreau | 8b0cbf9 | 2010-10-15 23:23:19 +0200 | [diff] [blame] | 287 | * - SRC3 : layer 3 (eg: IP) source address in standard text form |
| 288 | * - DST3 : layer 3 (eg: IP) destination address in standard text form |
| 289 | * - SRC4 : layer 4 (eg: TCP port) source address in standard text form |
| 290 | * - DST4 : layer 4 (eg: TCP port) destination address in standard text form |
| 291 | * |
| 292 | * This line MUST be at the beginning of the buffer and MUST NOT wrap. |
| 293 | * |
| 294 | * Once the data is fetched, the values are set in the session's field and data |
| 295 | * are removed from the buffer. The function returns zero if it needs to wait |
| 296 | * for more data (max: timeout_client), or 1 if it has finished and removed itself. |
| 297 | */ |
| 298 | int frontend_decode_proxy_request(struct session *s, struct buffer *req, int an_bit) |
| 299 | { |
| 300 | char *line = req->data; |
| 301 | char *end = req->data + req->l; |
Willy Tarreau | 8b0cbf9 | 2010-10-15 23:23:19 +0200 | [diff] [blame] | 302 | int len; |
| 303 | |
| 304 | DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bl=%d analysers=%02x\n", |
| 305 | now_ms, __FUNCTION__, |
| 306 | s, |
| 307 | req, |
| 308 | req->rex, req->wex, |
| 309 | req->flags, |
| 310 | req->l, |
| 311 | req->analysers); |
| 312 | |
| 313 | if (req->flags & (BF_READ_ERROR|BF_READ_TIMEOUT)) |
| 314 | goto fail; |
| 315 | |
Emeric Brun | f4711a3 | 2010-10-29 15:16:55 +0200 | [diff] [blame] | 316 | len = MIN(req->l, 6); |
| 317 | if (!len) |
Willy Tarreau | 8b0cbf9 | 2010-10-15 23:23:19 +0200 | [diff] [blame] | 318 | goto missing; |
| 319 | |
Emeric Brun | f4711a3 | 2010-10-29 15:16:55 +0200 | [diff] [blame] | 320 | /* Decode a possible proxy request, fail early if it does not match */ |
| 321 | if (strncmp(line, "PROXY ", len) != 0) |
Willy Tarreau | 8b0cbf9 | 2010-10-15 23:23:19 +0200 | [diff] [blame] | 322 | goto fail; |
Emeric Brun | f4711a3 | 2010-10-29 15:16:55 +0200 | [diff] [blame] | 323 | |
Willy Tarreau | 8b0cbf9 | 2010-10-15 23:23:19 +0200 | [diff] [blame] | 324 | line += 6; |
Emeric Brun | f4711a3 | 2010-10-29 15:16:55 +0200 | [diff] [blame] | 325 | if (req->l < 18) /* shortest possible line */ |
| 326 | goto missing; |
Willy Tarreau | 8b0cbf9 | 2010-10-15 23:23:19 +0200 | [diff] [blame] | 327 | |
Emeric Brun | 861ccff | 2010-10-29 12:03:03 +0200 | [diff] [blame] | 328 | if (!memcmp(line, "TCP4 ", 5) != 0) { |
| 329 | u32 src3, dst3, sport, dport; |
Willy Tarreau | 8b0cbf9 | 2010-10-15 23:23:19 +0200 | [diff] [blame] | 330 | |
Emeric Brun | 861ccff | 2010-10-29 12:03:03 +0200 | [diff] [blame] | 331 | line += 5; |
Willy Tarreau | 8b0cbf9 | 2010-10-15 23:23:19 +0200 | [diff] [blame] | 332 | |
Emeric Brun | 861ccff | 2010-10-29 12:03:03 +0200 | [diff] [blame] | 333 | src3 = inetaddr_host_lim_ret(line, end, &line); |
| 334 | if (line == end) |
| 335 | goto missing; |
| 336 | if (*line++ != ' ') |
| 337 | goto fail; |
Willy Tarreau | 8b0cbf9 | 2010-10-15 23:23:19 +0200 | [diff] [blame] | 338 | |
Emeric Brun | 861ccff | 2010-10-29 12:03:03 +0200 | [diff] [blame] | 339 | dst3 = inetaddr_host_lim_ret(line, end, &line); |
| 340 | if (line == end) |
| 341 | goto missing; |
| 342 | if (*line++ != ' ') |
| 343 | goto fail; |
Willy Tarreau | 8b0cbf9 | 2010-10-15 23:23:19 +0200 | [diff] [blame] | 344 | |
Emeric Brun | 861ccff | 2010-10-29 12:03:03 +0200 | [diff] [blame] | 345 | sport = read_uint((const char **)&line, end); |
| 346 | if (line == end) |
| 347 | goto missing; |
| 348 | if (*line++ != ' ') |
| 349 | goto fail; |
| 350 | |
| 351 | dport = read_uint((const char **)&line, end); |
| 352 | if (line > end - 2) |
| 353 | goto missing; |
| 354 | if (*line++ != '\r') |
| 355 | goto fail; |
| 356 | if (*line++ != '\n') |
| 357 | goto fail; |
Willy Tarreau | 8b0cbf9 | 2010-10-15 23:23:19 +0200 | [diff] [blame] | 358 | |
Emeric Brun | 861ccff | 2010-10-29 12:03:03 +0200 | [diff] [blame] | 359 | /* update the session's addresses and mark them set */ |
| 360 | ((struct sockaddr_in *)&s->cli_addr)->sin_family = AF_INET; |
| 361 | ((struct sockaddr_in *)&s->cli_addr)->sin_addr.s_addr = htonl(src3); |
| 362 | ((struct sockaddr_in *)&s->cli_addr)->sin_port = htons(sport); |
Willy Tarreau | 8b0cbf9 | 2010-10-15 23:23:19 +0200 | [diff] [blame] | 363 | |
Emeric Brun | 861ccff | 2010-10-29 12:03:03 +0200 | [diff] [blame] | 364 | ((struct sockaddr_in *)&s->frt_addr)->sin_family = AF_INET; |
| 365 | ((struct sockaddr_in *)&s->frt_addr)->sin_addr.s_addr = htonl(dst3); |
| 366 | ((struct sockaddr_in *)&s->frt_addr)->sin_port = htons(dport); |
| 367 | s->flags |= SN_FRT_ADDR_SET; |
| 368 | |
| 369 | } |
| 370 | else if (!memcmp(line, "TCP6 ", 5) != 0) { |
| 371 | u32 sport, dport; |
| 372 | char *src_s; |
| 373 | char *dst_s, *sport_s, *dport_s; |
| 374 | struct in6_addr src3, dst3; |
| 375 | |
| 376 | line+=5; |
| 377 | |
| 378 | src_s = line; |
| 379 | dst_s = sport_s = dport_s = NULL; |
| 380 | while (1) { |
| 381 | if (line > end - 2) { |
| 382 | goto missing; |
| 383 | } |
| 384 | else if (*line == '\r') { |
| 385 | *line = 0; |
| 386 | line++; |
| 387 | if (*line++ != '\n') |
| 388 | goto fail; |
| 389 | break; |
| 390 | } |
| 391 | |
| 392 | if (*line == ' ') { |
| 393 | *line = 0; |
| 394 | if (!dst_s) |
| 395 | dst_s = line+1; |
| 396 | else if (!sport_s) |
| 397 | sport_s = line+1; |
| 398 | else if (!dport_s) |
| 399 | dport_s = line+1; |
| 400 | } |
| 401 | line++; |
| 402 | } |
| 403 | |
| 404 | if (!dst_s || !sport_s || !dport_s) |
| 405 | goto fail; |
| 406 | |
| 407 | sport = read_uint((const char **)&sport_s,dport_s-1); |
| 408 | if ( *sport_s != 0 ) |
| 409 | goto fail; |
| 410 | |
| 411 | dport = read_uint((const char **)&dport_s,line-2); |
| 412 | if ( *dport_s != 0 ) |
| 413 | goto fail; |
| 414 | |
| 415 | if (inet_pton(AF_INET6, src_s, (void *)&src3) != 1) |
| 416 | goto fail; |
| 417 | |
| 418 | if (inet_pton(AF_INET6, dst_s, (void *)&dst3) != 1) |
| 419 | goto fail; |
| 420 | |
| 421 | /* update the session's addresses and mark them set */ |
| 422 | ((struct sockaddr_in6 *)&s->cli_addr)->sin6_family = AF_INET6; |
| 423 | memcpy(&((struct sockaddr_in6 *)&s->cli_addr)->sin6_addr, &src3, sizeof(struct in6_addr)); |
| 424 | ((struct sockaddr_in6 *)&s->cli_addr)->sin6_port = htons(sport); |
| 425 | |
| 426 | ((struct sockaddr_in6 *)&s->frt_addr)->sin6_family = AF_INET6; |
| 427 | memcpy(&((struct sockaddr_in6 *)&s->frt_addr)->sin6_addr, &dst3, sizeof(struct in6_addr)); |
| 428 | ((struct sockaddr_in6 *)&s->frt_addr)->sin6_port = htons(dport); |
| 429 | s->flags |= SN_FRT_ADDR_SET; |
| 430 | } |
| 431 | else { |
| 432 | goto fail; |
| 433 | } |
Willy Tarreau | 8b0cbf9 | 2010-10-15 23:23:19 +0200 | [diff] [blame] | 434 | |
| 435 | /* remove the PROXY line from the request */ |
| 436 | len = line - req->data; |
| 437 | buffer_replace2(req, req->data, line, NULL, 0); |
| 438 | req->total -= len; /* don't count the header line */ |
| 439 | |
| 440 | req->analysers &= ~an_bit; |
| 441 | return 1; |
| 442 | |
| 443 | missing: |
| 444 | if (!(req->flags & (BF_SHUTR|BF_FULL))) { |
| 445 | buffer_dont_connect(s->req); |
| 446 | return 0; |
| 447 | } |
| 448 | /* missing data and buffer is either full or shutdown => fail */ |
| 449 | |
| 450 | fail: |
| 451 | buffer_abort(req); |
| 452 | buffer_abort(s->rep); |
| 453 | req->analysers = 0; |
| 454 | |
| 455 | s->fe->counters.failed_req++; |
| 456 | if (s->listener->counters) |
| 457 | s->listener->counters->failed_req++; |
| 458 | |
| 459 | if (!(s->flags & SN_ERR_MASK)) |
| 460 | s->flags |= SN_ERR_PRXCOND; |
| 461 | if (!(s->flags & SN_FINST_MASK)) |
| 462 | s->flags |= SN_FINST_R; |
| 463 | return 0; |
| 464 | } |
| 465 | |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 466 | /* set test->i to the id of the frontend */ |
Willy Tarreau | d41f8d8 | 2007-06-10 10:06:18 +0200 | [diff] [blame] | 467 | static int |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 468 | acl_fetch_fe_id(struct proxy *px, struct session *l4, void *l7, int dir, |
| 469 | struct acl_expr *expr, struct acl_test *test) { |
Willy Tarreau | 662b2d8 | 2007-05-08 19:56:15 +0200 | [diff] [blame] | 470 | |
Willy Tarreau | 662b2d8 | 2007-05-08 19:56:15 +0200 | [diff] [blame] | 471 | test->flags = ACL_TEST_F_READ_ONLY; |
Willy Tarreau | 662b2d8 | 2007-05-08 19:56:15 +0200 | [diff] [blame] | 472 | |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 473 | test->i = l4->fe->uuid; |
Willy Tarreau | 662b2d8 | 2007-05-08 19:56:15 +0200 | [diff] [blame] | 474 | |
Emeric Brun | 5d16eda | 2010-01-04 15:47:45 +0100 | [diff] [blame] | 475 | return 1; |
| 476 | } |
| 477 | |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 478 | /* set test->i to the number of connections per second reaching the frontend */ |
Willy Tarreau | d41f8d8 | 2007-06-10 10:06:18 +0200 | [diff] [blame] | 479 | static int |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 480 | acl_fetch_fe_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir, |
| 481 | struct acl_expr *expr, struct acl_test *test) |
Willy Tarreau | 662b2d8 | 2007-05-08 19:56:15 +0200 | [diff] [blame] | 482 | { |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 483 | test->flags = ACL_TEST_F_VOL_TEST; |
| 484 | if (expr->arg_len) { |
| 485 | /* another proxy was designated, we must look for it */ |
| 486 | for (px = proxy; px; px = px->next) |
| 487 | if ((px->cap & PR_CAP_FE) && !strcmp(px->id, expr->arg.str)) |
| 488 | break; |
| 489 | } |
| 490 | if (!px) |
| 491 | return 0; |
Emeric Brun | 5d16eda | 2010-01-04 15:47:45 +0100 | [diff] [blame] | 492 | |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 493 | test->i = read_freq_ctr(&px->fe_sess_per_sec); |
Emeric Brun | 5d16eda | 2010-01-04 15:47:45 +0100 | [diff] [blame] | 494 | return 1; |
| 495 | } |
Alexandre Cassen | 5eb1a90 | 2007-11-29 15:43:32 +0100 | [diff] [blame] | 496 | |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 497 | /* set test->i to the number of concurrent connections on the frontend */ |
Willy Tarreau | d41f8d8 | 2007-06-10 10:06:18 +0200 | [diff] [blame] | 498 | static int |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 499 | acl_fetch_fe_conn(struct proxy *px, struct session *l4, void *l7, int dir, |
| 500 | struct acl_expr *expr, struct acl_test *test) |
Willy Tarreau | 8797c06 | 2007-05-07 00:55:35 +0200 | [diff] [blame] | 501 | { |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 502 | test->flags = ACL_TEST_F_VOL_TEST; |
| 503 | if (expr->arg_len) { |
| 504 | /* another proxy was designated, we must look for it */ |
| 505 | for (px = proxy; px; px = px->next) |
| 506 | if ((px->cap & PR_CAP_FE) && !strcmp(px->id, expr->arg.str)) |
| 507 | break; |
| 508 | } |
| 509 | if (!px) |
| 510 | return 0; |
Krzysztof Piotr Oledzki | 346f76d | 2010-01-12 21:59:30 +0100 | [diff] [blame] | 511 | |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 512 | test->i = px->feconn; |
Krzysztof Piotr Oledzki | 346f76d | 2010-01-12 21:59:30 +0100 | [diff] [blame] | 513 | return 1; |
| 514 | } |
| 515 | |
Willy Tarreau | 8797c06 | 2007-05-07 00:55:35 +0200 | [diff] [blame] | 516 | |
| 517 | /* Note: must not be declared <const> as its list will be overwritten */ |
| 518 | static struct acl_kw_list acl_kws = {{ },{ |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 519 | { "fe_id", acl_parse_int, acl_fetch_fe_id, acl_match_int, ACL_USE_NOTHING }, |
| 520 | { "fe_sess_rate", acl_parse_int, acl_fetch_fe_sess_rate, acl_match_int, ACL_USE_NOTHING }, |
| 521 | { "fe_conn", acl_parse_int, acl_fetch_fe_conn, acl_match_int, ACL_USE_NOTHING }, |
Willy Tarreau | 8797c06 | 2007-05-07 00:55:35 +0200 | [diff] [blame] | 522 | { NULL, NULL, NULL, NULL }, |
| 523 | }}; |
| 524 | |
| 525 | |
| 526 | __attribute__((constructor)) |
Willy Tarreau | 03fa5df | 2010-05-24 21:02:37 +0200 | [diff] [blame] | 527 | static void __frontend_init(void) |
Willy Tarreau | 8797c06 | 2007-05-07 00:55:35 +0200 | [diff] [blame] | 528 | { |
| 529 | acl_register_keywords(&acl_kws); |
| 530 | } |
| 531 | |
| 532 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 533 | /* |
| 534 | * Local variables: |
| 535 | * c-indent-level: 8 |
| 536 | * c-basic-offset: 8 |
| 537 | * End: |
| 538 | */ |