Index: trunk/debs/varnish3/debian/patches/01-varnishncsa-udp.dpatch |
— | — | @@ -2,12 +2,12 @@ |
3 | 3 | ## 01-varnishncsa-udp.dpatch by <root@ragweed.knams.wikimedia.org> |
4 | 4 | ## |
5 | 5 | ## All lines beginning with `## DP:' are a description of the patch. |
6 | | -## DP: multicast udp logging w/seq numbering |
| 6 | +## DP: multicast udp logging w/seq numbering |
7 | 7 | |
8 | 8 | @DPATCH@ |
9 | 9 | |
10 | 10 | --- varnish3-3.0.0~/bin/varnishncsa/varnishncsa.c 2011-08-09 23:55:17.000000000 +0000 |
11 | | -+++ varnish3-3.0.0/bin/varnishncsa/varnishncsa.c 2011-08-18 21:22:53.000000000 +0000 |
12 | 11 | @@ -79,6 +79,13 @@ |
13 | 12 | #include "varnishapi.h" |
14 | 13 | #include "base64.h" |
— | — | @@ -51,17 +51,19 @@ |
52 | 52 | fprintf(fo, "%s", tbuf); |
53 | 53 | break; |
54 | 54 | |
55 | | -@@ -695,12 +708,54 @@ |
| 55 | +@@ -695,12 +708,59 @@ |
56 | 56 | open_log(const char *ofn, int append) |
57 | 57 | { |
58 | 58 | FILE *of; |
59 | 59 | + int sockfd, portno, n; |
60 | 60 | + struct sockaddr_in serv_addr; |
| 61 | ++ struct in_addr iaddr; |
61 | 62 | + struct hostent *server; |
62 | | -+ u_char ttl = 6; |
| 63 | ++ u_char ttl = 10; |
63 | 64 | + char host[500]; |
64 | 65 | + char port[10]; |
65 | | -+ |
| 66 | ++ char loopch=0; |
| 67 | ++ |
66 | 68 | + sscanf(ofn, "%[^:]:%s", host, port); |
67 | 69 | + |
68 | 70 | + portno = atoi(port); |
— | — | @@ -70,34 +72,37 @@ |
71 | 73 | + if (sockfd < 0) { |
72 | 74 | + fprintf(stderr, "ERROR opening socket\n"); |
73 | 75 | + } |
74 | | - |
75 | | -- if ((of = fopen(ofn, append ? "a" : "w")) == NULL) { |
76 | | -- perror(ofn); |
| 76 | ++ |
77 | 77 | + server = gethostbyname(host); |
78 | 78 | + |
79 | 79 | + if (server == NULL) { |
80 | 80 | + fprintf(stderr,"ERROR, no such host\n"); |
81 | | - exit(1); |
| 81 | ++ exit(1); |
82 | 82 | + } |
83 | 83 | + |
84 | 84 | + bzero((char *) &serv_addr, sizeof(serv_addr)); |
85 | | -+ |
86 | | -+ if ((ntohl(serv_addr.sin_addr.s_addr) >> 28) == 0xe) { |
87 | | -+ serv_addr.sin_addr.s_addr = INADDR_ANY; |
88 | | -+ setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_IF, &serv_addr, |
89 | | -+ sizeof(struct sockaddr_in)); |
90 | | -+ setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, |
91 | | -+ sizeof(unsigned char)); |
92 | | - } |
93 | | -- return (of); |
94 | | -+ |
| 85 | + |
| 86 | +- if ((of = fopen(ofn, append ? "a" : "w")) == NULL) { |
| 87 | +- perror(ofn); |
95 | 88 | + serv_addr.sin_family = AF_INET; |
96 | 89 | + serv_addr.sin_port = htons(portno); |
| 90 | ++ bcopy((char *)server->h_addr, (char *)&serv_addr.sin_addr.s_addr, |
| 91 | ++ server->h_length); |
| 92 | ++ if ((ntohl(serv_addr.sin_addr.s_addr) >> 28) == 0xe) { |
| 93 | ++ iaddr.s_addr = INADDR_ANY; /* use DEFAULT interface */ |
| 94 | ++ setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_IF, &iaddr, |
| 95 | ++ sizeof(struct in_addr)); |
| 96 | ++ setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, |
| 97 | ++ sizeof(unsigned char)); |
| 98 | ++ setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_LOOP, /* don't send to own interface */ |
| 99 | ++ (char *)&loopch, sizeof(loopch)); |
| 100 | ++ } |
97 | 101 | + |
98 | 102 | + if (connect(sockfd,(struct sockaddr *) &serv_addr,sizeof(serv_addr)) < 0) { |
99 | 103 | + perror("socket"); |
100 | | -+ exit(1); |
101 | | -+ } |
| 104 | + exit(1); |
| 105 | + } |
| 106 | +- return (of); |
102 | 107 | + |
103 | 108 | + FILE *sf = fdopen(sockfd, "w"); |
104 | 109 | + |
— | — | @@ -109,7 +114,7 @@ |
110 | 115 | } |
111 | 116 | |
112 | 117 | /*--------------------------------------------------------------------*/ |
113 | | -@@ -711,7 +766,7 @@ |
| 118 | +@@ -711,7 +771,7 @@ |
114 | 119 | |
115 | 120 | fprintf(stderr, |
116 | 121 | "usage: varnishncsa %s [-aDV] [-n varnish_name] " |
— | — | @@ -118,7 +123,7 @@ |
119 | 124 | exit(1); |
120 | 125 | } |
121 | 126 | |
122 | | -@@ -724,7 +779,7 @@ |
| 127 | +@@ -724,7 +784,7 @@ |
123 | 128 | const char *w_arg = NULL; |
124 | 129 | struct vpf_fh *pfh = NULL; |
125 | 130 | FILE *of; |
— | — | @@ -127,7 +132,7 @@ |
128 | 133 | |
129 | 134 | vd = VSM_New(); |
130 | 135 | VSL_Setup(vd); |
131 | | -@@ -739,7 +794,7 @@ |
| 136 | +@@ -739,7 +799,7 @@ |
132 | 137 | fprintf(stderr, "-f and -F can not be combined\n"); |
133 | 138 | exit(1); |
134 | 139 | } |
Index: trunk/debs/varnish3/debian/changelog |
— | — | @@ -1,3 +1,9 @@ |
| 2 | +varnish3 (3.0.0-1wmf5) lucid; urgency=low |
| 3 | + |
| 4 | + * fix udp/mcast logging |
| 5 | + |
| 6 | + -- Asher Feldman <afledman@wikimedia.org> Thu, 29 Aug 2011 16:10:30 +0000 |
| 7 | + |
2 | 8 | varnish3 (3.0.0-1wmf4) lucid; urgency=low |
3 | 9 | |
4 | 10 | * -f (xff ip's) option defaulted to ncsa log format, now like wmf squids |