r95724 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95723‎ | r95724 | r95725 >
Date:23:11, 29 August 2011
Author:asher
Status:deferred
Tags:
Comment:
fix udp/mcast logging
Modified paths:
  • /trunk/debs/varnish3/debian/changelog (modified) (history)
  • /trunk/debs/varnish3/debian/patches/01-varnishncsa-udp.dpatch (modified) (history)

Diff [purge]

Index: trunk/debs/varnish3/debian/patches/01-varnishncsa-udp.dpatch
@@ -2,12 +2,12 @@
33 ## 01-varnishncsa-udp.dpatch by <root@ragweed.knams.wikimedia.org>
44 ##
55 ## 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
77
88 @DPATCH@
99
1010 --- 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
1211 @@ -79,6 +79,13 @@
1312 #include "varnishapi.h"
1413 #include "base64.h"
@@ -51,17 +51,19 @@
5252 fprintf(fo, "%s", tbuf);
5353 break;
5454
55 -@@ -695,12 +708,54 @@
 55+@@ -695,12 +708,59 @@
5656 open_log(const char *ofn, int append)
5757 {
5858 FILE *of;
5959 + int sockfd, portno, n;
6060 + struct sockaddr_in serv_addr;
 61++ struct in_addr iaddr;
6162 + struct hostent *server;
62 -+ u_char ttl = 6;
 63++ u_char ttl = 10;
6364 + char host[500];
6465 + char port[10];
65 -+
 66++ char loopch=0;
 67++
6668 + sscanf(ofn, "%[^:]:%s", host, port);
6769 +
6870 + portno = atoi(port);
@@ -70,34 +72,37 @@
7173 + if (sockfd < 0) {
7274 + fprintf(stderr, "ERROR opening socket\n");
7375 + }
74 -
75 -- if ((of = fopen(ofn, append ? "a" : "w")) == NULL) {
76 -- perror(ofn);
 76++
7777 + server = gethostbyname(host);
7878 +
7979 + if (server == NULL) {
8080 + fprintf(stderr,"ERROR, no such host\n");
81 - exit(1);
 81++ exit(1);
8282 + }
8383 +
8484 + 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);
9588 + serv_addr.sin_family = AF_INET;
9689 + 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++ }
97101 +
98102 + if (connect(sockfd,(struct sockaddr *) &serv_addr,sizeof(serv_addr)) < 0) {
99103 + perror("socket");
100 -+ exit(1);
101 -+ }
 104+ exit(1);
 105+ }
 106+- return (of);
102107 +
103108 + FILE *sf = fdopen(sockfd, "w");
104109 +
@@ -109,7 +114,7 @@
110115 }
111116
112117 /*--------------------------------------------------------------------*/
113 -@@ -711,7 +766,7 @@
 118+@@ -711,7 +771,7 @@
114119
115120 fprintf(stderr,
116121 "usage: varnishncsa %s [-aDV] [-n varnish_name] "
@@ -118,7 +123,7 @@
119124 exit(1);
120125 }
121126
122 -@@ -724,7 +779,7 @@
 127+@@ -724,7 +784,7 @@
123128 const char *w_arg = NULL;
124129 struct vpf_fh *pfh = NULL;
125130 FILE *of;
@@ -127,7 +132,7 @@
128133
129134 vd = VSM_New();
130135 VSL_Setup(vd);
131 -@@ -739,7 +794,7 @@
 136+@@ -739,7 +799,7 @@
132137 fprintf(stderr, "-f and -F can not be combined\n");
133138 exit(1);
134139 }
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+
28 varnish3 (3.0.0-1wmf4) lucid; urgency=low
39
410 * -f (xff ip's) option defaulted to ncsa log format, now like wmf squids

Status & tagging log