pound/2.5/dynamic-backends.patch
changeset 19 e12b21f08628
parent 18 7ce365612e43
child 20 0f2a3cea40c9
equal deleted inserted replaced
18:7ce365612e43 19:e12b21f08628
     1 diff -r badbd0960f5b config.c
     1 diff -r badbd0960f5b config.c
     2 --- a/config.c	Mon May 09 11:00:36 2011 +0200
     2 --- a/config.c	Mon May 09 11:00:36 2011 +0200
     3 +++ b/config.c	Wed May 11 16:04:14 2011 +0200
     3 +++ b/config.c	Thu May 12 10:27:43 2011 +0200
     4 @@ -77,7 +77,7 @@
     4 @@ -77,7 +77,7 @@
     5  static regex_t  Service, ServiceName, URL, HeadRequire, HeadDeny, BackEnd, Emergency, Priority, HAport, HAportAddr;
     5  static regex_t  Service, ServiceName, URL, HeadRequire, HeadDeny, BackEnd, Emergency, Priority, HAport, HAportAddr;
     6  static regex_t  Redirect, RedirectN, TimeOut, Session, Type, TTL, ID, DynScale;
     6  static regex_t  Redirect, RedirectN, TimeOut, Session, Type, TTL, ID, DynScale;
     7  static regex_t  ClientCert, AddHeader, Ciphers, CAlist, VerifyList, CRLlist, NoHTTPS11;
     7  static regex_t  ClientCert, AddHeader, Ciphers, CAlist, VerifyList, CRLlist, NoHTTPS11;
     8 -static regex_t  Grace, Include, ConnTO, IgnoreCase, HTTPS, HTTPSCert;
     8 -static regex_t  Grace, Include, ConnTO, IgnoreCase, HTTPS, HTTPSCert;
    21      res->conn_to = is_emergency? 120: be_connto;
    21      res->conn_to = is_emergency? 120: be_connto;
    22 @@ -200,6 +200,9 @@
    22 @@ -200,6 +200,9 @@
    23              lin[strlen(lin) - 1] = '\0';
    23              lin[strlen(lin) - 1] = '\0';
    24          if(!regexec(&Address, lin, 4, matches, 0)) {
    24          if(!regexec(&Address, lin, 4, matches, 0)) {
    25              lin[matches[1].rm_eo] = '\0';
    25              lin[matches[1].rm_eo] = '\0';
    26 +            if((res->hostname = (char *)malloc(matches[1].rm_eo - matches[1].rm_so)) == NULL)
    26 +            if((res->hostname = (char *)malloc(matches[1].rm_eo - matches[1].rm_so + 1)) == NULL)
    27 +                conf_err("out of memory");
    27 +                conf_err("out of memory");
    28 +            memcpy(res->hostname, lin + matches[1].rm_so, matches[1].rm_eo - matches[1].rm_so);
    28 +            memcpy(res->hostname, lin + matches[1].rm_so, matches[1].rm_eo - matches[1].rm_so + 1);
    29              if(get_host(lin + matches[1].rm_so, &res->addr)) {
    29              if(get_host(lin + matches[1].rm_so, &res->addr)) {
    30                  /* if we can't resolve it assume this is a UNIX domain socket */
    30                  /* if we can't resolve it assume this is a UNIX domain socket */
    31                  res->addr.ai_socktype = SOCK_STREAM;
    31                  res->addr.ai_socktype = SOCK_STREAM;
    32 @@ -243,6 +246,7 @@
    32 @@ -243,6 +246,7 @@
    33              if(is_emergency)
    33              if(is_emergency)
    39              memcpy(res->ha_addr.ai_addr, res->addr.ai_addr, res->addr.ai_addrlen);
    39              memcpy(res->ha_addr.ai_addr, res->addr.ai_addr, res->addr.ai_addrlen);
    40 @@ -264,6 +268,9 @@
    40 @@ -264,6 +268,9 @@
    41              if(is_emergency)
    41              if(is_emergency)
    42                  conf_err("HAportAddr is not supported for Emergency back-ends");
    42                  conf_err("HAportAddr is not supported for Emergency back-ends");
    43              lin[matches[1].rm_eo] = '\0';
    43              lin[matches[1].rm_eo] = '\0';
    44 +            if((res->ha_hostname = (char *)malloc(matches[1].rm_eo - matches[1].rm_so)) == NULL)
    44 +            if((res->ha_hostname = (char *)malloc(matches[1].rm_eo - matches[1].rm_so + 1)) == NULL)
    45 +                conf_err("out of memory");
    45 +                conf_err("out of memory");
    46 +            memcpy(res->ha_hostname, lin + matches[1].rm_so, matches[1].rm_eo - matches[1].rm_so);
    46 +            memcpy(res->ha_hostname, lin + matches[1].rm_so, matches[1].rm_eo - matches[1].rm_so + 1);
    47              if(get_host(lin + matches[1].rm_so, &res->ha_addr)) {
    47              if(get_host(lin + matches[1].rm_so, &res->ha_addr)) {
    48                  /* if we can't resolve it assume this is a UNIX domain socket */
    48                  /* if we can't resolve it assume this is a UNIX domain socket */
    49                  res->addr.ai_socktype = SOCK_STREAM;
    49                  res->addr.ai_socktype = SOCK_STREAM;
    50 @@ -313,6 +320,10 @@
    50 @@ -313,6 +320,10 @@
    51              SSL_CTX_set_session_id_context(res->ctx, (unsigned char *)lin, strlen(lin));
    51              SSL_CTX_set_session_id_context(res->ctx, (unsigned char *)lin, strlen(lin));
    67      ) {
    67      ) {
    68          logmsg(LOG_ERR, "bad config Regex - aborted");
    68          logmsg(LOG_ERR, "bad config Regex - aborted");
    69          exit(1);
    69          exit(1);
    70 diff -r badbd0960f5b debian/changelog
    70 diff -r badbd0960f5b debian/changelog
    71 --- a/debian/changelog	Mon May 09 11:00:36 2011 +0200
    71 --- a/debian/changelog	Mon May 09 11:00:36 2011 +0200
    72 +++ b/debian/changelog	Wed May 11 16:04:14 2011 +0200
    72 +++ b/debian/changelog	Thu May 12 10:27:43 2011 +0200
    73 @@ -1,3 +1,9 @@
    73 @@ -1,3 +1,15 @@
       
    74 +pound (2.5-1~bpo50+3) lenny-backports; urgency=low
       
    75 +
       
    76 +  * fixed manpage formatting 
       
    77 +
       
    78 + -- Matthias Förste <foerste@schlittermann.de>  Wed, 11 May 2011 16:40:39 +0200
       
    79 +
    74 +pound (2.5-1~bpo50+2) lenny-backports; urgency=low
    80 +pound (2.5-1~bpo50+2) lenny-backports; urgency=low
    75 +
    81 +
    76 +  * patched to deal with backend addresses on dynamic ips
    82 +  * patched to deal with backend addresses on dynamic ips
    77 +
    83 +
    78 + -- Matthias Förste <foerste@schlittermann.de>  Wed, 11 May 2011 15:52:38 +0200
    84 + -- Matthias Förste <foerste@schlittermann.de>  Wed, 11 May 2011 15:52:38 +0200
    80  pound (2.5-1~bpo50+1) lenny-backports; urgency=low
    86  pound (2.5-1~bpo50+1) lenny-backports; urgency=low
    81  
    87  
    82    * Rebuild for lenny-backports.
    88    * Rebuild for lenny-backports.
    83 diff -r badbd0960f5b http.c
    89 diff -r badbd0960f5b http.c
    84 --- a/http.c	Mon May 09 11:00:36 2011 +0200
    90 --- a/http.c	Mon May 09 11:00:36 2011 +0200
    85 +++ b/http.c	Wed May 11 16:04:14 2011 +0200
    91 +++ b/http.c	Thu May 12 10:27:43 2011 +0200
    86 @@ -773,6 +773,13 @@
    92 @@ -773,6 +773,13 @@
    87                  pthread_exit(NULL);
    93                  pthread_exit(NULL);
    88                  break;
    94                  break;
    89              }
    95              }
    90 +            if (backend->dyn_addr && upd_addr(backend->hostname, &backend->addr)) {
    96 +            if (backend->dyn_addr && upd_addr(backend->hostname, &backend->addr)) {
    97              if((sock = socket(sock_proto, SOCK_STREAM, 0)) < 0) {
   103              if((sock = socket(sock_proto, SOCK_STREAM, 0)) < 0) {
    98                  str_be(buf, MAXBUF - 1, backend);
   104                  str_be(buf, MAXBUF - 1, backend);
    99                  logmsg(LOG_WARNING, "(%lx) e503 backend %s socket create: %s", pthread_self(), buf, strerror(errno));
   105                  logmsg(LOG_WARNING, "(%lx) e503 backend %s socket create: %s", pthread_self(), buf, strerror(errno));
   100 diff -r badbd0960f5b pound.8
   106 diff -r badbd0960f5b pound.8
   101 --- a/pound.8	Mon May 09 11:00:36 2011 +0200
   107 --- a/pound.8	Mon May 09 11:00:36 2011 +0200
   102 +++ b/pound.8	Wed May 11 16:04:14 2011 +0200
   108 +++ b/pound.8	Thu May 12 10:27:43 2011 +0200
   103 @@ -682,6 +682,22 @@
   109 @@ -682,6 +682,24 @@
   104  .B Pound
   110  .B Pound
   105  uses the same address as the back-end server, but you may use a separate address
   111  uses the same address as the back-end server, but you may use a separate address
   106  if you wish. This directive applies only to non Unix-domain servers.
   112  if you wish. This directive applies only to non Unix-domain servers.
       
   113 +.TP
   107 +\fBDynamicAddress\fR
   114 +\fBDynamicAddress\fR
   108 +If this directive is present then the
   115 +If this directive is present then the
   109 +.I Address
   116 +.I Address
   110 +given for this
   117 +given for this
   111 +.I Backend
   118 +.I Backend
   112 +is considered a dynamic address. It is resolved whenever a connection attempt
   119 +is considered a dynamic address. It is resolved whenever a connection attempt
   113 +to that
   120 +to that
   114 +.I Address
   121 +.I Address
   115 +is made.
   122 +is made.
       
   123 +.TP
   116 +\fBDynamicHAAddress\fR
   124 +\fBDynamicHAAddress\fR
   117 +This is the same as
   125 +This is the same as
   118 +.I DynamicAddress
   126 +.I DynamicAddress
   119 +except that it applies to the address given in the
   127 +except that it applies to the address given in the
   120 +.I HAPort
   128 +.I HAPort
   123  .SH "Emergency"
   131  .SH "Emergency"
   124  The emergency server will be used once all existing back-ends are "dead".
   132  The emergency server will be used once all existing back-ends are "dead".
   125  All configuration directives enclosed between
   133  All configuration directives enclosed between
   126 diff -r badbd0960f5b pound.h
   134 diff -r badbd0960f5b pound.h
   127 --- a/pound.h	Mon May 09 11:00:36 2011 +0200
   135 --- a/pound.h	Mon May 09 11:00:36 2011 +0200
   128 +++ b/pound.h	Wed May 11 16:04:14 2011 +0200
   136 +++ b/pound.h	Thu May 12 10:27:43 2011 +0200
   129 @@ -308,6 +308,10 @@
   137 @@ -308,6 +308,10 @@
   130      int                 alive;      /* false if the back-end is dead */
   138      int                 alive;      /* false if the back-end is dead */
   131      int                 resurrect;  /* this back-end is to be resurrected */
   139      int                 resurrect;  /* this back-end is to be resurrected */
   132      int                 disabled;   /* true if the back-end is disabled */
   140      int                 disabled;   /* true if the back-end is disabled */
   133 +    int                 dyn_addr;     /* true if the address of the backend may change over time (dynamic ip for example) */
   141 +    int                 dyn_addr;     /* true if the address of the backend may change over time (dynamic ip for example) */
   144 +
   152 +
   145 +/* update address */
   153 +/* update address */
   146 +int upd_addr(char *hostname, struct addrinfo *ai);
   154 +int upd_addr(char *hostname, struct addrinfo *ai);
   147 diff -r badbd0960f5b svc.c
   155 diff -r badbd0960f5b svc.c
   148 --- a/svc.c	Mon May 09 11:00:36 2011 +0200
   156 --- a/svc.c	Mon May 09 11:00:36 2011 +0200
   149 +++ b/svc.c	Wed May 11 16:04:14 2011 +0200
   157 +++ b/svc.c	Thu May 12 10:27:43 2011 +0200
   150 @@ -904,6 +904,9 @@
   158 @@ -904,6 +904,9 @@
   151          default:
   159          default:
   152              continue;
   160              continue;
   153          }
   161          }
   154 +        if (be->dyn_ha_addr && upd_addr(be->ha_hostname, &be->ha_addr)) {
   162 +        if (be->dyn_ha_addr && upd_addr(be->ha_hostname, &be->ha_addr)) {