Willy Tarreau | dd81598 | 2007-10-16 12:25:14 +0200 | [diff] [blame] | 1 | /* |
Willy Tarreau | d1d5454 | 2012-09-12 22:58:11 +0200 | [diff] [blame] | 2 | * Listener management functions. |
Willy Tarreau | dd81598 | 2007-10-16 12:25:14 +0200 | [diff] [blame] | 3 | * |
Willy Tarreau | d1d5454 | 2012-09-12 22:58:11 +0200 | [diff] [blame] | 4 | * Copyright 2000-2012 Willy Tarreau <w@1wt.eu> |
Willy Tarreau | dd81598 | 2007-10-16 12:25:14 +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 | |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 13 | #include <errno.h> |
Willy Tarreau | dd81598 | 2007-10-16 12:25:14 +0200 | [diff] [blame] | 14 | #include <stdio.h> |
| 15 | #include <string.h> |
| 16 | |
Willy Tarreau | 1bc4aab | 2012-10-08 20:11:03 +0200 | [diff] [blame] | 17 | #include <common/accept4.h> |
Willy Tarreau | dd81598 | 2007-10-16 12:25:14 +0200 | [diff] [blame] | 18 | #include <common/config.h> |
Willy Tarreau | dabf2e2 | 2007-10-28 21:59:24 +0100 | [diff] [blame] | 19 | #include <common/errors.h> |
Willy Tarreau | dd81598 | 2007-10-16 12:25:14 +0200 | [diff] [blame] | 20 | #include <common/mini-clist.h> |
| 21 | #include <common/standard.h> |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 22 | #include <common/time.h> |
| 23 | |
| 24 | #include <types/global.h> |
Willy Tarreau | d1d5454 | 2012-09-12 22:58:11 +0200 | [diff] [blame] | 25 | #include <types/protocol.h> |
Willy Tarreau | dd81598 | 2007-10-16 12:25:14 +0200 | [diff] [blame] | 26 | |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 27 | #include <proto/acl.h> |
Willy Tarreau | b648d63 | 2007-10-28 22:13:50 +0100 | [diff] [blame] | 28 | #include <proto/fd.h> |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 29 | #include <proto/freq_ctr.h> |
| 30 | #include <proto/log.h> |
| 31 | #include <proto/task.h> |
Willy Tarreau | b648d63 | 2007-10-28 22:13:50 +0100 | [diff] [blame] | 32 | |
Willy Tarreau | 2698266 | 2012-09-12 23:17:10 +0200 | [diff] [blame] | 33 | /* List head of all known bind keywords */ |
| 34 | static struct bind_kw_list bind_keywords = { |
| 35 | .list = LIST_HEAD_INIT(bind_keywords.list) |
| 36 | }; |
| 37 | |
Willy Tarreau | dabf2e2 | 2007-10-28 21:59:24 +0100 | [diff] [blame] | 38 | /* This function adds the specified listener's file descriptor to the polling |
| 39 | * lists if it is in the LI_LISTEN state. The listener enters LI_READY or |
| 40 | * LI_FULL state depending on its number of connections. |
| 41 | */ |
| 42 | void enable_listener(struct listener *listener) |
| 43 | { |
| 44 | if (listener->state == LI_LISTEN) { |
| 45 | if (listener->nbconn < listener->maxconn) { |
Willy Tarreau | 49b046d | 2012-08-09 12:11:58 +0200 | [diff] [blame] | 46 | fd_want_recv(listener->fd); |
Willy Tarreau | dabf2e2 | 2007-10-28 21:59:24 +0100 | [diff] [blame] | 47 | listener->state = LI_READY; |
| 48 | } else { |
| 49 | listener->state = LI_FULL; |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | /* This function removes the specified listener's file descriptor from the |
| 55 | * polling lists if it is in the LI_READY or in the LI_FULL state. The listener |
| 56 | * enters LI_LISTEN. |
| 57 | */ |
| 58 | void disable_listener(struct listener *listener) |
| 59 | { |
| 60 | if (listener->state < LI_READY) |
| 61 | return; |
| 62 | if (listener->state == LI_READY) |
Willy Tarreau | 49b046d | 2012-08-09 12:11:58 +0200 | [diff] [blame] | 63 | fd_stop_recv(listener->fd); |
Willy Tarreau | e6ca1fc | 2011-07-24 22:03:52 +0200 | [diff] [blame] | 64 | if (listener->state == LI_LIMITED) |
| 65 | LIST_DEL(&listener->wait_queue); |
Willy Tarreau | dabf2e2 | 2007-10-28 21:59:24 +0100 | [diff] [blame] | 66 | listener->state = LI_LISTEN; |
| 67 | } |
| 68 | |
Willy Tarreau | be58c38 | 2011-07-24 18:28:10 +0200 | [diff] [blame] | 69 | /* This function tries to temporarily disable a listener, depending on the OS |
| 70 | * capabilities. Linux unbinds the listen socket after a SHUT_RD, and ignores |
| 71 | * SHUT_WR. Solaris refuses either shutdown(). OpenBSD ignores SHUT_RD but |
| 72 | * closes upon SHUT_WR and refuses to rebind. So a common validation path |
| 73 | * involves SHUT_WR && listen && SHUT_RD. In case of success, the FD's polling |
| 74 | * is disabled. It normally returns non-zero, unless an error is reported. |
| 75 | */ |
| 76 | int pause_listener(struct listener *l) |
| 77 | { |
| 78 | if (l->state <= LI_PAUSED) |
| 79 | return 1; |
| 80 | |
Willy Tarreau | b3fb60b | 2012-10-04 08:56:31 +0200 | [diff] [blame] | 81 | if (l->proto->sock_prot == IPPROTO_TCP) { |
| 82 | if (shutdown(l->fd, SHUT_WR) != 0) |
| 83 | return 0; /* Solaris dies here */ |
Willy Tarreau | be58c38 | 2011-07-24 18:28:10 +0200 | [diff] [blame] | 84 | |
Willy Tarreau | b3fb60b | 2012-10-04 08:56:31 +0200 | [diff] [blame] | 85 | if (listen(l->fd, l->backlog ? l->backlog : l->maxconn) != 0) |
| 86 | return 0; /* OpenBSD dies here */ |
Willy Tarreau | be58c38 | 2011-07-24 18:28:10 +0200 | [diff] [blame] | 87 | |
Willy Tarreau | b3fb60b | 2012-10-04 08:56:31 +0200 | [diff] [blame] | 88 | if (shutdown(l->fd, SHUT_RD) != 0) |
| 89 | return 0; /* should always be OK */ |
| 90 | } |
Willy Tarreau | be58c38 | 2011-07-24 18:28:10 +0200 | [diff] [blame] | 91 | |
Willy Tarreau | e6ca1fc | 2011-07-24 22:03:52 +0200 | [diff] [blame] | 92 | if (l->state == LI_LIMITED) |
| 93 | LIST_DEL(&l->wait_queue); |
| 94 | |
Willy Tarreau | 49b046d | 2012-08-09 12:11:58 +0200 | [diff] [blame] | 95 | fd_stop_recv(l->fd); |
Willy Tarreau | be58c38 | 2011-07-24 18:28:10 +0200 | [diff] [blame] | 96 | l->state = LI_PAUSED; |
| 97 | return 1; |
| 98 | } |
| 99 | |
Willy Tarreau | e6ca1fc | 2011-07-24 22:03:52 +0200 | [diff] [blame] | 100 | /* This function tries to resume a temporarily disabled listener. Paused, full, |
| 101 | * limited and disabled listeners are handled, which means that this function |
| 102 | * may replace enable_listener(). The resulting state will either be LI_READY |
| 103 | * or LI_FULL. 0 is returned in case of failure to resume (eg: dead socket). |
Willy Tarreau | be58c38 | 2011-07-24 18:28:10 +0200 | [diff] [blame] | 104 | */ |
| 105 | int resume_listener(struct listener *l) |
| 106 | { |
| 107 | if (l->state < LI_PAUSED) |
| 108 | return 0; |
| 109 | |
Willy Tarreau | b3fb60b | 2012-10-04 08:56:31 +0200 | [diff] [blame] | 110 | if (l->proto->sock_prot == IPPROTO_TCP && |
| 111 | l->state == LI_PAUSED && |
Willy Tarreau | be58c38 | 2011-07-24 18:28:10 +0200 | [diff] [blame] | 112 | listen(l->fd, l->backlog ? l->backlog : l->maxconn) != 0) |
| 113 | return 0; |
| 114 | |
| 115 | if (l->state == LI_READY) |
| 116 | return 1; |
| 117 | |
Willy Tarreau | e6ca1fc | 2011-07-24 22:03:52 +0200 | [diff] [blame] | 118 | if (l->state == LI_LIMITED) |
| 119 | LIST_DEL(&l->wait_queue); |
| 120 | |
Willy Tarreau | be58c38 | 2011-07-24 18:28:10 +0200 | [diff] [blame] | 121 | if (l->nbconn >= l->maxconn) { |
| 122 | l->state = LI_FULL; |
| 123 | return 1; |
| 124 | } |
| 125 | |
Willy Tarreau | 49b046d | 2012-08-09 12:11:58 +0200 | [diff] [blame] | 126 | fd_want_recv(l->fd); |
Willy Tarreau | be58c38 | 2011-07-24 18:28:10 +0200 | [diff] [blame] | 127 | l->state = LI_READY; |
| 128 | return 1; |
| 129 | } |
| 130 | |
Willy Tarreau | 6279371 | 2011-07-24 19:23:38 +0200 | [diff] [blame] | 131 | /* Marks a ready listener as full so that the session code tries to re-enable |
| 132 | * it upon next close() using resume_listener(). |
| 133 | */ |
| 134 | void listener_full(struct listener *l) |
| 135 | { |
| 136 | if (l->state >= LI_READY) { |
Willy Tarreau | e6ca1fc | 2011-07-24 22:03:52 +0200 | [diff] [blame] | 137 | if (l->state == LI_LIMITED) |
| 138 | LIST_DEL(&l->wait_queue); |
| 139 | |
Willy Tarreau | 49b046d | 2012-08-09 12:11:58 +0200 | [diff] [blame] | 140 | fd_stop_recv(l->fd); |
Willy Tarreau | 6279371 | 2011-07-24 19:23:38 +0200 | [diff] [blame] | 141 | l->state = LI_FULL; |
| 142 | } |
| 143 | } |
| 144 | |
Willy Tarreau | e6ca1fc | 2011-07-24 22:03:52 +0200 | [diff] [blame] | 145 | /* Marks a ready listener as limited so that we only try to re-enable it when |
| 146 | * resources are free again. It will be queued into the specified queue. |
| 147 | */ |
| 148 | void limit_listener(struct listener *l, struct list *list) |
| 149 | { |
| 150 | if (l->state == LI_READY) { |
| 151 | LIST_ADDQ(list, &l->wait_queue); |
Willy Tarreau | 49b046d | 2012-08-09 12:11:58 +0200 | [diff] [blame] | 152 | fd_stop_recv(l->fd); |
Willy Tarreau | e6ca1fc | 2011-07-24 22:03:52 +0200 | [diff] [blame] | 153 | l->state = LI_LIMITED; |
| 154 | } |
| 155 | } |
| 156 | |
Willy Tarreau | dabf2e2 | 2007-10-28 21:59:24 +0100 | [diff] [blame] | 157 | /* This function adds all of the protocol's listener's file descriptors to the |
| 158 | * polling lists when they are in the LI_LISTEN state. It is intended to be |
| 159 | * used as a protocol's generic enable_all() primitive, for use after the |
| 160 | * fork(). It puts the listeners into LI_READY or LI_FULL states depending on |
| 161 | * their number of connections. It always returns ERR_NONE. |
| 162 | */ |
| 163 | int enable_all_listeners(struct protocol *proto) |
| 164 | { |
| 165 | struct listener *listener; |
| 166 | |
| 167 | list_for_each_entry(listener, &proto->listeners, proto_list) |
| 168 | enable_listener(listener); |
| 169 | return ERR_NONE; |
| 170 | } |
| 171 | |
| 172 | /* This function removes all of the protocol's listener's file descriptors from |
| 173 | * the polling lists when they are in the LI_READY or LI_FULL states. It is |
| 174 | * intended to be used as a protocol's generic disable_all() primitive. It puts |
| 175 | * the listeners into LI_LISTEN, and always returns ERR_NONE. |
| 176 | */ |
| 177 | int disable_all_listeners(struct protocol *proto) |
| 178 | { |
| 179 | struct listener *listener; |
| 180 | |
| 181 | list_for_each_entry(listener, &proto->listeners, proto_list) |
| 182 | disable_listener(listener); |
| 183 | return ERR_NONE; |
| 184 | } |
| 185 | |
Willy Tarreau | e6ca1fc | 2011-07-24 22:03:52 +0200 | [diff] [blame] | 186 | /* Dequeues all of the listeners waiting for a resource in wait queue <queue>. */ |
| 187 | void dequeue_all_listeners(struct list *list) |
| 188 | { |
| 189 | struct listener *listener, *l_back; |
| 190 | |
| 191 | list_for_each_entry_safe(listener, l_back, list, wait_queue) { |
| 192 | /* This cannot fail because the listeners are by definition in |
| 193 | * the LI_LIMITED state. The function also removes the entry |
| 194 | * from the queue. |
| 195 | */ |
| 196 | resume_listener(listener); |
| 197 | } |
| 198 | } |
| 199 | |
Willy Tarreau | b648d63 | 2007-10-28 22:13:50 +0100 | [diff] [blame] | 200 | /* This function closes the listening socket for the specified listener, |
| 201 | * provided that it's already in a listening state. The listener enters the |
| 202 | * LI_ASSIGNED state. It always returns ERR_NONE. This function is intended |
| 203 | * to be used as a generic function for standard protocols. |
| 204 | */ |
| 205 | int unbind_listener(struct listener *listener) |
| 206 | { |
| 207 | if (listener->state == LI_READY) |
Willy Tarreau | 49b046d | 2012-08-09 12:11:58 +0200 | [diff] [blame] | 208 | fd_stop_recv(listener->fd); |
Willy Tarreau | b648d63 | 2007-10-28 22:13:50 +0100 | [diff] [blame] | 209 | |
Willy Tarreau | e6ca1fc | 2011-07-24 22:03:52 +0200 | [diff] [blame] | 210 | if (listener->state == LI_LIMITED) |
| 211 | LIST_DEL(&listener->wait_queue); |
| 212 | |
Willy Tarreau | be58c38 | 2011-07-24 18:28:10 +0200 | [diff] [blame] | 213 | if (listener->state >= LI_PAUSED) { |
Willy Tarreau | b648d63 | 2007-10-28 22:13:50 +0100 | [diff] [blame] | 214 | fd_delete(listener->fd); |
| 215 | listener->state = LI_ASSIGNED; |
| 216 | } |
| 217 | return ERR_NONE; |
| 218 | } |
| 219 | |
Willy Tarreau | 3acf8c3 | 2007-10-28 22:35:41 +0100 | [diff] [blame] | 220 | /* This function closes all listening sockets bound to the protocol <proto>, |
| 221 | * and the listeners end in LI_ASSIGNED state if they were higher. It does not |
| 222 | * detach them from the protocol. It always returns ERR_NONE. |
| 223 | */ |
| 224 | int unbind_all_listeners(struct protocol *proto) |
| 225 | { |
| 226 | struct listener *listener; |
| 227 | |
| 228 | list_for_each_entry(listener, &proto->listeners, proto_list) |
| 229 | unbind_listener(listener); |
| 230 | return ERR_NONE; |
| 231 | } |
| 232 | |
Willy Tarreau | 1a64d16 | 2007-10-28 22:26:05 +0100 | [diff] [blame] | 233 | /* Delete a listener from its protocol's list of listeners. The listener's |
| 234 | * state is automatically updated from LI_ASSIGNED to LI_INIT. The protocol's |
| 235 | * number of listeners is updated. Note that the listener must have previously |
| 236 | * been unbound. This is the generic function to use to remove a listener. |
| 237 | */ |
| 238 | void delete_listener(struct listener *listener) |
| 239 | { |
| 240 | if (listener->state != LI_ASSIGNED) |
| 241 | return; |
| 242 | listener->state = LI_INIT; |
| 243 | LIST_DEL(&listener->proto_list); |
| 244 | listener->proto->nb_listeners--; |
| 245 | } |
| 246 | |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 247 | /* This function is called on a read event from a listening socket, corresponding |
| 248 | * to an accept. It tries to accept as many connections as possible, and for each |
| 249 | * calls the listener's accept handler (generally the frontend's accept handler). |
| 250 | */ |
Willy Tarreau | afad0e0 | 2012-08-09 14:45:22 +0200 | [diff] [blame] | 251 | void listener_accept(int fd) |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 252 | { |
| 253 | struct listener *l = fdtab[fd].owner; |
| 254 | struct proxy *p = l->frontend; |
| 255 | int max_accept = global.tune.maxaccept; |
| 256 | int cfd; |
| 257 | int ret; |
| 258 | |
| 259 | if (unlikely(l->nbconn >= l->maxconn)) { |
| 260 | listener_full(l); |
Willy Tarreau | afad0e0 | 2012-08-09 14:45:22 +0200 | [diff] [blame] | 261 | return; |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | if (global.cps_lim && !(l->options & LI_O_UNLIMITED)) { |
| 265 | int max = freq_ctr_remain(&global.conn_per_sec, global.cps_lim, 0); |
| 266 | |
| 267 | if (unlikely(!max)) { |
| 268 | /* frontend accept rate limit was reached */ |
| 269 | limit_listener(l, &global_listener_queue); |
| 270 | task_schedule(global_listener_queue_task, tick_add(now_ms, next_event_delay(&global.conn_per_sec, global.cps_lim, 0))); |
Willy Tarreau | afad0e0 | 2012-08-09 14:45:22 +0200 | [diff] [blame] | 271 | return; |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | if (max_accept > max) |
| 275 | max_accept = max; |
| 276 | } |
| 277 | |
| 278 | if (p && p->fe_sps_lim) { |
| 279 | int max = freq_ctr_remain(&p->fe_sess_per_sec, p->fe_sps_lim, 0); |
| 280 | |
| 281 | if (unlikely(!max)) { |
| 282 | /* frontend accept rate limit was reached */ |
| 283 | limit_listener(l, &p->listener_queue); |
| 284 | task_schedule(p->task, tick_add(now_ms, next_event_delay(&p->fe_sess_per_sec, p->fe_sps_lim, 0))); |
Willy Tarreau | afad0e0 | 2012-08-09 14:45:22 +0200 | [diff] [blame] | 285 | return; |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 286 | } |
| 287 | |
| 288 | if (max_accept > max) |
| 289 | max_accept = max; |
| 290 | } |
| 291 | |
| 292 | /* Note: if we fail to allocate a connection because of configured |
| 293 | * limits, we'll schedule a new attempt worst 1 second later in the |
| 294 | * worst case. If we fail due to system limits or temporary resource |
| 295 | * shortage, we try again 100ms later in the worst case. |
| 296 | */ |
| 297 | while (max_accept--) { |
| 298 | struct sockaddr_storage addr; |
| 299 | socklen_t laddr = sizeof(addr); |
| 300 | |
| 301 | if (unlikely(actconn >= global.maxconn) && !(l->options & LI_O_UNLIMITED)) { |
| 302 | limit_listener(l, &global_listener_queue); |
| 303 | task_schedule(global_listener_queue_task, tick_add(now_ms, 1000)); /* try again in 1 second */ |
Willy Tarreau | afad0e0 | 2012-08-09 14:45:22 +0200 | [diff] [blame] | 304 | return; |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | if (unlikely(p && p->feconn >= p->maxconn)) { |
| 308 | limit_listener(l, &p->listener_queue); |
Willy Tarreau | afad0e0 | 2012-08-09 14:45:22 +0200 | [diff] [blame] | 309 | return; |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 310 | } |
| 311 | |
Willy Tarreau | 1bc4aab | 2012-10-08 20:11:03 +0200 | [diff] [blame] | 312 | #ifdef USE_ACCEPT4 |
| 313 | cfd = accept4(fd, (struct sockaddr *)&addr, &laddr, SOCK_NONBLOCK); |
| 314 | #else |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 315 | cfd = accept(fd, (struct sockaddr *)&addr, &laddr); |
Willy Tarreau | 1bc4aab | 2012-10-08 20:11:03 +0200 | [diff] [blame] | 316 | #endif |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 317 | if (unlikely(cfd == -1)) { |
| 318 | switch (errno) { |
| 319 | case EAGAIN: |
| 320 | case EINTR: |
| 321 | case ECONNABORTED: |
Willy Tarreau | afad0e0 | 2012-08-09 14:45:22 +0200 | [diff] [blame] | 322 | fd_poll_recv(fd); |
| 323 | return; /* nothing more to accept */ |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 324 | case ENFILE: |
| 325 | if (p) |
| 326 | send_log(p, LOG_EMERG, |
| 327 | "Proxy %s reached system FD limit at %d. Please check system tunables.\n", |
| 328 | p->id, maxfd); |
| 329 | limit_listener(l, &global_listener_queue); |
| 330 | task_schedule(global_listener_queue_task, tick_add(now_ms, 100)); /* try again in 100 ms */ |
Willy Tarreau | afad0e0 | 2012-08-09 14:45:22 +0200 | [diff] [blame] | 331 | return; |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 332 | case EMFILE: |
| 333 | if (p) |
| 334 | send_log(p, LOG_EMERG, |
| 335 | "Proxy %s reached process FD limit at %d. Please check 'ulimit-n' and restart.\n", |
| 336 | p->id, maxfd); |
| 337 | limit_listener(l, &global_listener_queue); |
| 338 | task_schedule(global_listener_queue_task, tick_add(now_ms, 100)); /* try again in 100 ms */ |
Willy Tarreau | afad0e0 | 2012-08-09 14:45:22 +0200 | [diff] [blame] | 339 | return; |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 340 | case ENOBUFS: |
| 341 | case ENOMEM: |
| 342 | if (p) |
| 343 | send_log(p, LOG_EMERG, |
| 344 | "Proxy %s reached system memory limit at %d sockets. Please check system tunables.\n", |
| 345 | p->id, maxfd); |
| 346 | limit_listener(l, &global_listener_queue); |
| 347 | task_schedule(global_listener_queue_task, tick_add(now_ms, 100)); /* try again in 100 ms */ |
Willy Tarreau | afad0e0 | 2012-08-09 14:45:22 +0200 | [diff] [blame] | 348 | return; |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 349 | default: |
Willy Tarreau | afad0e0 | 2012-08-09 14:45:22 +0200 | [diff] [blame] | 350 | /* unexpected result, let's go back to poll */ |
| 351 | fd_poll_recv(fd); |
| 352 | return; |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 353 | } |
| 354 | } |
| 355 | |
| 356 | if (unlikely(cfd >= global.maxsock)) { |
| 357 | send_log(p, LOG_EMERG, |
| 358 | "Proxy %s reached the configured maximum connection limit. Please check the global 'maxconn' value.\n", |
| 359 | p->id); |
| 360 | close(cfd); |
| 361 | limit_listener(l, &global_listener_queue); |
| 362 | task_schedule(global_listener_queue_task, tick_add(now_ms, 1000)); /* try again in 1 second */ |
Willy Tarreau | afad0e0 | 2012-08-09 14:45:22 +0200 | [diff] [blame] | 363 | return; |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 364 | } |
| 365 | |
| 366 | /* increase the per-process number of cumulated connections */ |
| 367 | if (!(l->options & LI_O_UNLIMITED)) { |
| 368 | update_freq_ctr(&global.conn_per_sec, 1); |
| 369 | if (global.conn_per_sec.curr_ctr > global.cps_max) |
| 370 | global.cps_max = global.conn_per_sec.curr_ctr; |
| 371 | actconn++; |
| 372 | } |
| 373 | |
| 374 | jobs++; |
| 375 | totalconn++; |
| 376 | l->nbconn++; |
| 377 | |
| 378 | if (l->counters) { |
| 379 | if (l->nbconn > l->counters->conn_max) |
| 380 | l->counters->conn_max = l->nbconn; |
| 381 | } |
| 382 | |
| 383 | ret = l->accept(l, cfd, &addr); |
| 384 | if (unlikely(ret <= 0)) { |
| 385 | /* The connection was closed by session_accept(). Either |
| 386 | * we just have to ignore it (ret == 0) or it's a critical |
| 387 | * error due to a resource shortage, and we must stop the |
| 388 | * listener (ret < 0). |
| 389 | */ |
| 390 | if (!(l->options & LI_O_UNLIMITED)) |
| 391 | actconn--; |
| 392 | jobs--; |
| 393 | l->nbconn--; |
| 394 | if (ret == 0) /* successful termination */ |
| 395 | continue; |
| 396 | |
| 397 | limit_listener(l, &global_listener_queue); |
| 398 | task_schedule(global_listener_queue_task, tick_add(now_ms, 100)); /* try again in 100 ms */ |
Willy Tarreau | afad0e0 | 2012-08-09 14:45:22 +0200 | [diff] [blame] | 399 | return; |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 400 | } |
| 401 | |
| 402 | if (l->nbconn >= l->maxconn) { |
| 403 | listener_full(l); |
Willy Tarreau | afad0e0 | 2012-08-09 14:45:22 +0200 | [diff] [blame] | 404 | return; |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 405 | } |
| 406 | |
Willy Tarreau | aece46a | 2012-07-06 12:25:58 +0200 | [diff] [blame] | 407 | } /* end of while (max_accept--) */ |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 408 | |
Willy Tarreau | aece46a | 2012-07-06 12:25:58 +0200 | [diff] [blame] | 409 | /* we've exhausted max_accept, so there is no need to poll again */ |
Willy Tarreau | afad0e0 | 2012-08-09 14:45:22 +0200 | [diff] [blame] | 410 | return; |
Willy Tarreau | bbebbbf | 2012-05-07 21:22:09 +0200 | [diff] [blame] | 411 | } |
| 412 | |
Willy Tarreau | 2698266 | 2012-09-12 23:17:10 +0200 | [diff] [blame] | 413 | /* |
| 414 | * Registers the bind keyword list <kwl> as a list of valid keywords for next |
| 415 | * parsing sessions. |
| 416 | */ |
| 417 | void bind_register_keywords(struct bind_kw_list *kwl) |
| 418 | { |
| 419 | LIST_ADDQ(&bind_keywords.list, &kwl->list); |
| 420 | } |
| 421 | |
| 422 | /* Return a pointer to the bind keyword <kw>, or NULL if not found. If the |
| 423 | * keyword is found with a NULL ->parse() function, then an attempt is made to |
| 424 | * find one with a valid ->parse() function. This way it is possible to declare |
| 425 | * platform-dependant, known keywords as NULL, then only declare them as valid |
| 426 | * if some options are met. Note that if the requested keyword contains an |
| 427 | * opening parenthesis, everything from this point is ignored. |
| 428 | */ |
| 429 | struct bind_kw *bind_find_kw(const char *kw) |
| 430 | { |
| 431 | int index; |
| 432 | const char *kwend; |
| 433 | struct bind_kw_list *kwl; |
| 434 | struct bind_kw *ret = NULL; |
| 435 | |
| 436 | kwend = strchr(kw, '('); |
| 437 | if (!kwend) |
| 438 | kwend = kw + strlen(kw); |
| 439 | |
| 440 | list_for_each_entry(kwl, &bind_keywords.list, list) { |
| 441 | for (index = 0; kwl->kw[index].kw != NULL; index++) { |
| 442 | if ((strncmp(kwl->kw[index].kw, kw, kwend - kw) == 0) && |
| 443 | kwl->kw[index].kw[kwend-kw] == 0) { |
| 444 | if (kwl->kw[index].parse) |
| 445 | return &kwl->kw[index]; /* found it !*/ |
| 446 | else |
| 447 | ret = &kwl->kw[index]; /* may be OK */ |
| 448 | } |
| 449 | } |
| 450 | } |
| 451 | return ret; |
| 452 | } |
| 453 | |
Willy Tarreau | 8638f48 | 2012-09-18 18:01:17 +0200 | [diff] [blame] | 454 | /* Dumps all registered "bind" keywords to the <out> string pointer. The |
| 455 | * unsupported keywords are only dumped if their supported form was not |
| 456 | * found. |
| 457 | */ |
| 458 | void bind_dump_kws(char **out) |
| 459 | { |
| 460 | struct bind_kw_list *kwl; |
| 461 | int index; |
| 462 | |
| 463 | *out = NULL; |
| 464 | list_for_each_entry(kwl, &bind_keywords.list, list) { |
| 465 | for (index = 0; kwl->kw[index].kw != NULL; index++) { |
| 466 | if (kwl->kw[index].parse || |
| 467 | bind_find_kw(kwl->kw[index].kw) == &kwl->kw[index]) { |
Willy Tarreau | 51fb765 | 2012-09-18 18:24:39 +0200 | [diff] [blame] | 468 | memprintf(out, "%s[%4s] %s%s%s\n", *out ? *out : "", |
| 469 | kwl->scope, |
Willy Tarreau | 8638f48 | 2012-09-18 18:01:17 +0200 | [diff] [blame] | 470 | kwl->kw[index].kw, |
Willy Tarreau | 51fb765 | 2012-09-18 18:24:39 +0200 | [diff] [blame] | 471 | kwl->kw[index].skip ? " <arg>" : "", |
| 472 | kwl->kw[index].parse ? "" : " (not supported)"); |
Willy Tarreau | 8638f48 | 2012-09-18 18:01:17 +0200 | [diff] [blame] | 473 | } |
| 474 | } |
| 475 | } |
| 476 | } |
| 477 | |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 478 | /************************************************************************/ |
| 479 | /* All supported ACL keywords must be declared here. */ |
| 480 | /************************************************************************/ |
| 481 | |
Willy Tarreau | a5e3756 | 2011-12-16 17:06:15 +0100 | [diff] [blame] | 482 | /* set temp integer to the number of connexions to the same listening socket */ |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 483 | static int |
Willy Tarreau | 32a6f2e | 2012-04-25 10:13:36 +0200 | [diff] [blame] | 484 | acl_fetch_dconn(struct proxy *px, struct session *l4, void *l7, unsigned int opt, |
Willy Tarreau | 24e32d8 | 2012-04-23 23:55:44 +0200 | [diff] [blame] | 485 | const struct arg *args, struct sample *smp) |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 486 | { |
Willy Tarreau | f853c46 | 2012-04-23 18:53:56 +0200 | [diff] [blame] | 487 | smp->type = SMP_T_UINT; |
| 488 | smp->data.uint = l4->listener->nbconn; |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 489 | return 1; |
| 490 | } |
| 491 | |
Willy Tarreau | a5e3756 | 2011-12-16 17:06:15 +0100 | [diff] [blame] | 492 | /* set temp integer to the id of the socket (listener) */ |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 493 | static int |
Willy Tarreau | 32a6f2e | 2012-04-25 10:13:36 +0200 | [diff] [blame] | 494 | acl_fetch_so_id(struct proxy *px, struct session *l4, void *l7, unsigned int opt, |
Willy Tarreau | 24e32d8 | 2012-04-23 23:55:44 +0200 | [diff] [blame] | 495 | const struct arg *args, struct sample *smp) |
Willy Tarreau | 3740635 | 2012-04-23 16:16:37 +0200 | [diff] [blame] | 496 | { |
Willy Tarreau | f853c46 | 2012-04-23 18:53:56 +0200 | [diff] [blame] | 497 | smp->type = SMP_T_UINT; |
| 498 | smp->data.uint = l4->listener->luid; |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 499 | return 1; |
| 500 | } |
| 501 | |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 502 | /* parse the "accept-proxy" bind keyword */ |
Willy Tarreau | 4348fad | 2012-09-20 16:48:07 +0200 | [diff] [blame] | 503 | static int bind_parse_accept_proxy(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err) |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 504 | { |
| 505 | struct listener *l; |
| 506 | |
Willy Tarreau | 4348fad | 2012-09-20 16:48:07 +0200 | [diff] [blame] | 507 | list_for_each_entry(l, &conf->listeners, by_bind) |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 508 | l->options |= LI_O_ACC_PROXY; |
| 509 | |
| 510 | return 0; |
| 511 | } |
| 512 | |
| 513 | /* parse the "backlog" bind keyword */ |
Willy Tarreau | 4348fad | 2012-09-20 16:48:07 +0200 | [diff] [blame] | 514 | static int bind_parse_backlog(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err) |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 515 | { |
| 516 | struct listener *l; |
| 517 | int val; |
| 518 | |
| 519 | if (!*args[cur_arg + 1]) { |
Willy Tarreau | eb6cead | 2012-09-20 19:43:14 +0200 | [diff] [blame] | 520 | memprintf(err, "'%s' : missing value", args[cur_arg]); |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 521 | return ERR_ALERT | ERR_FATAL; |
| 522 | } |
| 523 | |
| 524 | val = atol(args[cur_arg + 1]); |
| 525 | if (val <= 0) { |
Willy Tarreau | eb6cead | 2012-09-20 19:43:14 +0200 | [diff] [blame] | 526 | memprintf(err, "'%s' : invalid value %d, must be > 0", args[cur_arg], val); |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 527 | return ERR_ALERT | ERR_FATAL; |
| 528 | } |
| 529 | |
Willy Tarreau | 4348fad | 2012-09-20 16:48:07 +0200 | [diff] [blame] | 530 | list_for_each_entry(l, &conf->listeners, by_bind) |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 531 | l->backlog = val; |
| 532 | |
| 533 | return 0; |
| 534 | } |
| 535 | |
| 536 | /* parse the "id" bind keyword */ |
Willy Tarreau | 4348fad | 2012-09-20 16:48:07 +0200 | [diff] [blame] | 537 | static int bind_parse_id(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err) |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 538 | { |
| 539 | struct eb32_node *node; |
Willy Tarreau | 4348fad | 2012-09-20 16:48:07 +0200 | [diff] [blame] | 540 | struct listener *l, *new; |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 541 | |
Willy Tarreau | 4348fad | 2012-09-20 16:48:07 +0200 | [diff] [blame] | 542 | if (conf->listeners.n != conf->listeners.p) { |
Willy Tarreau | eb6cead | 2012-09-20 19:43:14 +0200 | [diff] [blame] | 543 | memprintf(err, "'%s' can only be used with a single socket", args[cur_arg]); |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 544 | return ERR_ALERT | ERR_FATAL; |
| 545 | } |
| 546 | |
| 547 | if (!*args[cur_arg + 1]) { |
Willy Tarreau | eb6cead | 2012-09-20 19:43:14 +0200 | [diff] [blame] | 548 | memprintf(err, "'%s' : expects an integer argument", args[cur_arg]); |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 549 | return ERR_ALERT | ERR_FATAL; |
| 550 | } |
| 551 | |
Willy Tarreau | 4348fad | 2012-09-20 16:48:07 +0200 | [diff] [blame] | 552 | new = LIST_NEXT(&conf->listeners, struct listener *, by_bind); |
| 553 | new->luid = atol(args[cur_arg + 1]); |
| 554 | new->conf.id.key = new->luid; |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 555 | |
Willy Tarreau | 4348fad | 2012-09-20 16:48:07 +0200 | [diff] [blame] | 556 | if (new->luid <= 0) { |
Willy Tarreau | eb6cead | 2012-09-20 19:43:14 +0200 | [diff] [blame] | 557 | memprintf(err, "'%s' : custom id has to be > 0", args[cur_arg]); |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 558 | return ERR_ALERT | ERR_FATAL; |
| 559 | } |
| 560 | |
Willy Tarreau | 4348fad | 2012-09-20 16:48:07 +0200 | [diff] [blame] | 561 | node = eb32_lookup(&px->conf.used_listener_id, new->luid); |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 562 | if (node) { |
| 563 | l = container_of(node, struct listener, conf.id); |
Willy Tarreau | eb6cead | 2012-09-20 19:43:14 +0200 | [diff] [blame] | 564 | memprintf(err, "'%s' : custom id %d already used at %s:%d ('bind %s')", |
| 565 | args[cur_arg], l->luid, l->bind_conf->file, l->bind_conf->line, |
| 566 | l->bind_conf->arg); |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 567 | return ERR_ALERT | ERR_FATAL; |
| 568 | } |
| 569 | |
Willy Tarreau | 4348fad | 2012-09-20 16:48:07 +0200 | [diff] [blame] | 570 | eb32_insert(&px->conf.used_listener_id, &new->conf.id); |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 571 | return 0; |
| 572 | } |
| 573 | |
| 574 | /* parse the "maxconn" bind keyword */ |
Willy Tarreau | 4348fad | 2012-09-20 16:48:07 +0200 | [diff] [blame] | 575 | static int bind_parse_maxconn(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err) |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 576 | { |
| 577 | struct listener *l; |
| 578 | int val; |
| 579 | |
| 580 | if (!*args[cur_arg + 1]) { |
Willy Tarreau | eb6cead | 2012-09-20 19:43:14 +0200 | [diff] [blame] | 581 | memprintf(err, "'%s' : missing value", args[cur_arg]); |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 582 | return ERR_ALERT | ERR_FATAL; |
| 583 | } |
| 584 | |
| 585 | val = atol(args[cur_arg + 1]); |
| 586 | if (val <= 0) { |
Willy Tarreau | eb6cead | 2012-09-20 19:43:14 +0200 | [diff] [blame] | 587 | memprintf(err, "'%s' : invalid value %d, must be > 0", args[cur_arg], val); |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 588 | return ERR_ALERT | ERR_FATAL; |
| 589 | } |
| 590 | |
Willy Tarreau | 4348fad | 2012-09-20 16:48:07 +0200 | [diff] [blame] | 591 | list_for_each_entry(l, &conf->listeners, by_bind) |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 592 | l->maxconn = val; |
| 593 | |
| 594 | return 0; |
| 595 | } |
| 596 | |
| 597 | /* parse the "name" bind keyword */ |
Willy Tarreau | 4348fad | 2012-09-20 16:48:07 +0200 | [diff] [blame] | 598 | static int bind_parse_name(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err) |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 599 | { |
| 600 | struct listener *l; |
| 601 | |
| 602 | if (!*args[cur_arg + 1]) { |
Willy Tarreau | eb6cead | 2012-09-20 19:43:14 +0200 | [diff] [blame] | 603 | memprintf(err, "'%s' : missing name", args[cur_arg]); |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 604 | return ERR_ALERT | ERR_FATAL; |
| 605 | } |
| 606 | |
Willy Tarreau | 4348fad | 2012-09-20 16:48:07 +0200 | [diff] [blame] | 607 | list_for_each_entry(l, &conf->listeners, by_bind) |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 608 | l->name = strdup(args[cur_arg + 1]); |
| 609 | |
| 610 | return 0; |
| 611 | } |
| 612 | |
| 613 | /* parse the "nice" bind keyword */ |
Willy Tarreau | 4348fad | 2012-09-20 16:48:07 +0200 | [diff] [blame] | 614 | static int bind_parse_nice(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err) |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 615 | { |
| 616 | struct listener *l; |
| 617 | int val; |
| 618 | |
| 619 | if (!*args[cur_arg + 1]) { |
Willy Tarreau | eb6cead | 2012-09-20 19:43:14 +0200 | [diff] [blame] | 620 | memprintf(err, "'%s' : missing value", args[cur_arg]); |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 621 | return ERR_ALERT | ERR_FATAL; |
| 622 | } |
| 623 | |
| 624 | val = atol(args[cur_arg + 1]); |
| 625 | if (val < -1024 || val > 1024) { |
Willy Tarreau | eb6cead | 2012-09-20 19:43:14 +0200 | [diff] [blame] | 626 | memprintf(err, "'%s' : invalid value %d, allowed range is -1024..1024", args[cur_arg], val); |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 627 | return ERR_ALERT | ERR_FATAL; |
| 628 | } |
| 629 | |
Willy Tarreau | 4348fad | 2012-09-20 16:48:07 +0200 | [diff] [blame] | 630 | list_for_each_entry(l, &conf->listeners, by_bind) |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 631 | l->nice = val; |
| 632 | |
| 633 | return 0; |
| 634 | } |
| 635 | |
| 636 | |
Willy Tarreau | 61612d4 | 2012-04-19 18:42:05 +0200 | [diff] [blame] | 637 | /* Note: must not be declared <const> as its list will be overwritten. |
| 638 | * Please take care of keeping this list alphabetically sorted. |
| 639 | */ |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 640 | static struct acl_kw_list acl_kws = {{ },{ |
Willy Tarreau | 61612d4 | 2012-04-19 18:42:05 +0200 | [diff] [blame] | 641 | { "dst_conn", acl_parse_int, acl_fetch_dconn, acl_match_int, ACL_USE_NOTHING, 0 }, |
| 642 | { "so_id", acl_parse_int, acl_fetch_so_id, acl_match_int, ACL_USE_NOTHING, 0 }, |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 643 | { NULL, NULL, NULL, NULL }, |
| 644 | }}; |
| 645 | |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 646 | /* Note: must not be declared <const> as its list will be overwritten. |
| 647 | * Please take care of keeping this list alphabetically sorted, doing so helps |
| 648 | * all code contributors. |
| 649 | * Optional keywords are also declared with a NULL ->parse() function so that |
| 650 | * the config parser can report an appropriate error when a known keyword was |
| 651 | * not enabled. |
| 652 | */ |
Willy Tarreau | 51fb765 | 2012-09-18 18:24:39 +0200 | [diff] [blame] | 653 | static struct bind_kw_list bind_kws = { "ALL", { }, { |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 654 | { "accept-proxy", bind_parse_accept_proxy, 0 }, /* enable PROXY protocol */ |
| 655 | { "backlog", bind_parse_backlog, 1 }, /* set backlog of listening socket */ |
| 656 | { "id", bind_parse_id, 1 }, /* set id of listening socket */ |
| 657 | { "maxconn", bind_parse_maxconn, 1 }, /* set maxconn of listening socket */ |
| 658 | { "name", bind_parse_name, 1 }, /* set name of listening socket */ |
| 659 | { "nice", bind_parse_nice, 1 }, /* set nice of listening socket */ |
| 660 | { NULL, NULL, 0 }, |
| 661 | }}; |
| 662 | |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 663 | __attribute__((constructor)) |
Willy Tarreau | d1d5454 | 2012-09-12 22:58:11 +0200 | [diff] [blame] | 664 | static void __listener_init(void) |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 665 | { |
| 666 | acl_register_keywords(&acl_kws); |
Willy Tarreau | 3dcc341 | 2012-09-18 17:17:28 +0200 | [diff] [blame] | 667 | bind_register_keywords(&bind_kws); |
Willy Tarreau | 645513a | 2010-05-24 20:55:15 +0200 | [diff] [blame] | 668 | } |
| 669 | |
| 670 | /* |
| 671 | * Local variables: |
| 672 | * c-indent-level: 8 |
| 673 | * c-basic-offset: 8 |
| 674 | * End: |
| 675 | */ |