~ubuntu-branches/ubuntu/wily/haproxy/wily-proposed

« back to all changes in this revision

Viewing changes to src/proto_tcp.c

  • Committer: Package Import Robot
  • Author(s): Vincent Bernat
  • Date: 2014-10-31 13:48:19 UTC
  • mfrom: (23.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20141031134819-tm3f5woyik0oajpb
Tags: 1.5.8-1
* New upstream stable release including the following fixes:

   + BUG/MAJOR: buffer: check the space left is enough or not when input
                data in a buffer is wrapped
   + BUG/MINOR: ssl: correctly initialize ssl ctx for invalid certificates
   + BUG/MEDIUM: tcp: don't use SO_ORIGINAL_DST on non-AF_INET sockets
   + BUG/MEDIUM: regex: fix pcre_study error handling
   + BUG/MEDIUM: tcp: fix outgoing polling based on proxy protocol
   + BUG/MINOR: log: fix request flags when keep-alive is enabled
   + BUG/MAJOR: cli: explicitly call cli_release_handler() upon error
   + BUG/MEDIUM: http: don't dump debug headers on MSG_ERROR
* Also includes the following new features:
   + MINOR: ssl: add statement to force some ssl options in global.
   + MINOR: ssl: add fetchs 'ssl_c_der' and 'ssl_f_der' to return DER
            formatted certs
* Disable SSLv3 in the default configuration file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
450
450
                }
451
451
        }
452
452
 
453
 
        /* if a send_proxy is there, there are data */
454
 
        data |= conn->send_proxy_ofs;
455
 
 
456
453
#if defined(TCP_QUICKACK)
457
454
        /* disabling tcp quick ack now allows the first request to leave the
458
455
         * machine with the first ACK. We only do this if there are pending
459
456
         * data in the buffer.
460
457
         */
461
 
        if (delack == 2 || ((delack || data) && (be->options2 & PR_O2_SMARTCON)))
 
458
        if (delack == 2 || ((delack || data || conn->send_proxy_ofs) && (be->options2 & PR_O2_SMARTCON)))
462
459
                setsockopt(fd, IPPROTO_TCP, TCP_QUICKACK, &zero, sizeof(zero));
463
460
#endif
464
461
 
558
555
{
559
556
        if (dir)
560
557
                return getpeername(fd, sa, &salen);
 
558
        else {
 
559
                int ret = getsockname(fd, sa, &salen);
 
560
 
 
561
                if (ret < 0)
 
562
                        return ret;
 
563
 
561
564
#if defined(TPROXY) && defined(SO_ORIGINAL_DST)
562
 
        else if (getsockopt(fd, SOL_IP, SO_ORIGINAL_DST, sa, &salen) == 0)
563
 
                return 0;
 
565
                /* For TPROXY and Netfilter's NAT, we can retrieve the original
 
566
                 * IPv4 address before DNAT/REDIRECT. We must not do that with
 
567
                 * other families because v6-mapped IPv4 addresses are still
 
568
                 * reported as v4.
 
569
                 */
 
570
                if (((struct sockaddr_storage *)sa)->ss_family == AF_INET
 
571
                    && getsockopt(fd, SOL_IP, SO_ORIGINAL_DST, sa, &salen) == 0)
 
572
                        return 0;
564
573
#endif
565
 
        else
566
 
                return getsockname(fd, sa, &salen);
 
574
                return ret;
 
575
        }
567
576
}
568
577
 
569
578
/* Tries to drain any pending incoming data from the socket to reach the
1427
1436
        }
1428
1437
        else if (strncmp(args[arg], "track-sc", 8) == 0 &&
1429
1438
                 args[arg][9] == '\0' && args[arg][8] >= '0' &&
1430
 
                 args[arg][8] <= '0' + MAX_SESS_STKCTR) { /* track-sc 0..9 */
 
1439
                 args[arg][8] < '0' + MAX_SESS_STKCTR) { /* track-sc 0..9 */
1431
1440
                struct sample_expr *expr;
1432
1441
                int kw = arg;
1433
1442
 
1491
1500
                memprintf(err,
1492
1501
                          "'%s %s' expects 'accept', 'reject', 'track-sc0' ... 'track-sc%d' "
1493
1502
                          " in %s '%s' (got '%s')",
1494
 
                          args[0], args[1], MAX_SESS_STKCTR, proxy_type_str(curpx), curpx->id, args[arg]);
 
1503
                          args[0], args[1], MAX_SESS_STKCTR-1, proxy_type_str(curpx), curpx->id, args[arg]);
1495
1504
                return -1;
1496
1505
        }
1497
1506
 
1711
1720
                        warn++;
1712
1721
                }
1713
1722
 
 
1723
                /* the following function directly emits the warning */
 
1724
                warnif_misplaced_tcp_cont(curpx, file, line, args[0]);
1714
1725
                LIST_ADDQ(&curpx->tcp_req.inspect_rules, &rule->list);
1715
1726
        }
1716
1727
        else if (strcmp(args[1], "connection") == 0) {
1754
1765
                        warn++;
1755
1766
                }
1756
1767
 
 
1768
                /* the following function directly emits the warning */
 
1769
                warnif_misplaced_tcp_conn(curpx, file, line, args[0]);
1757
1770
                LIST_ADDQ(&curpx->tcp_req.l4_rules, &rule->list);
1758
1771
        }
1759
1772
        else {