... | ... |
@@ -23,6 +23,9 @@ core: |
23 | 23 |
- new parts: |
24 | 24 |
UNIX domain socket server implemented |
25 | 25 |
- changes: |
26 |
+ - multicast support added (see mcast_loopback & mcast_ttl) |
|
27 |
+ - saving of procces group id enabled, if the -G option is specified |
|
28 |
+ (a safe way to quickly kill all ser processes) |
|
26 | 29 |
- core dump-ing is enabled by default, see also disable_core_dump |
27 | 30 |
- protocol and port can be specified in the alias and listen lines, e.g.: |
28 | 31 |
alias= tcp:foo.bar:* udp:test.bar:5080 foo.com |
... | ... |
@@ -31,6 +34,8 @@ core: |
31 | 34 |
==, !=, ~= for strings |
32 | 35 |
==, !=, >, <, >=, <= for integers |
33 | 36 |
- new config variables: |
37 |
+ mcast_loopback = <yes/no> - loopback sent multicast datagram, default no. |
|
38 |
+ mcast_ttl = number - set multicast ttl, default OS specific (usually 1). |
|
34 | 39 |
sock_mode = <permissions> (e.g. sock_mode=0600: default value = 0660) |
35 | 40 |
ser unix sockets and fifo will be created with this permissions |
36 | 41 |
(old name fifo_mode is still supported, but deprecated) |
... | ... |
@@ -48,6 +48,8 @@ |
48 | 48 |
* 2004-03-30 added DISABLE_CORE and OPEN_FD_LIMIT (andrei) |
49 | 49 |
* 2004-04-28 added sock_mode (replaces fifo_mode), sock_user & |
50 | 50 |
* sock_group (andrei) |
51 |
+ * 2004-05-03 applied multicast support patch from janakj |
|
52 |
+ * added MCAST_TTL (andrei) |
|
51 | 53 |
*/ |
52 | 54 |
|
53 | 55 |
|
... | ... |
@@ -53,6 +53,8 @@ |
53 | 53 |
* 2004-02-24 added LOAD_AVP_T and AVP_TO_URI_T (bogdan) |
54 | 54 |
* 2004-03-30 added DISABLE_CORE and OPEN_FD_LIMIT (andrei) |
55 | 55 |
* 2004-04-29 added SOCK_MODE, SOCK_USER & SOCK_GROUP (andrei) |
56 |
+ * 2004-05-03 applied multicast support patch (MCAST_LOOPBACK) from janakj |
|
57 |
+ added MCAST_TTL (andrei) |
|
56 | 58 |
*/ |
57 | 59 |
|
58 | 60 |
|
... | ... |
@@ -243,6 +245,7 @@ static struct id_list* mk_listen_id(char*, int, int); |
243 | 245 |
%token DISABLE_CORE |
244 | 246 |
%token OPEN_FD_LIMIT |
245 | 247 |
%token MCAST_LOOPBACK |
248 |
+%token MCAST_TTL |
|
246 | 249 |
|
247 | 250 |
|
248 | 251 |
|
... | ... |
@@ -665,8 +668,15 @@ assign_stm: DEBUG EQUAL NUMBER { debug=$3; } |
665 | 668 |
warn("no multicast support compiled in"); |
666 | 669 |
#endif |
667 | 670 |
} |
668 |
- | MCAST_LOOPBACK EQUAL error { yyerror("boolean value expected"); } |
|
669 |
- |
|
671 |
+ | MCAST_LOOPBACK EQUAL error { yyerror("boolean value expected"); } |
|
672 |
+ | MCAST_TTL EQUAL NUMBER { |
|
673 |
+ #ifdef USE_MCAST |
|
674 |
+ mcast_ttl=$3; |
|
675 |
+ #else |
|
676 |
+ warn("no multicast support compiled in"); |
|
677 |
+ #endif |
|
678 |
+ } |
|
679 |
+ | MCAST_TTL EQUAL error { yyerror("number expected"); } |
|
670 | 680 |
| error EQUAL { yyerror("unknown config variable"); } |
671 | 681 |
; |
672 | 682 |
|
... | ... |
@@ -31,7 +31,7 @@ |
31 | 31 |
* 2004-02-20 removed from ser main.c into its own file (andrei) |
32 | 32 |
* 2004-03-04 moved setuid/setgid in do_suid() (andrei) |
33 | 33 |
* 2004-03-25 added increase_open_fds & set_core_dump (andrei) |
34 |
- * 2004-04-04 applied pgid patch from janakj |
|
34 |
+ * 2004-05-03 applied pgid patch from janakj |
|
35 | 35 |
*/ |
36 | 36 |
|
37 | 37 |
#define _XOPEN_SOURCE |
... | ... |
@@ -143,6 +143,9 @@ static char flags[]= |
143 | 143 |
#ifdef DISABLE_NAGLE |
144 | 144 |
", DISABLE_NAGLE" |
145 | 145 |
#endif |
146 |
+#ifdef USE_MCAST |
|
147 |
+", USE_MCAST" |
|
148 |
+#endif |
|
146 | 149 |
#ifdef NO_DEBUG |
147 | 150 |
", NO_DEBUG" |
148 | 151 |
#endif |
... | ... |
@@ -348,6 +351,7 @@ int reply_to_via=0; |
348 | 351 |
|
349 | 352 |
#ifdef USE_MCAST |
350 | 353 |
int mcast_loopback = 0; |
354 |
+int mcast_ttl = -1; /* if -1, don't touch it, use the default (usually 1) */ |
|
351 | 355 |
#endif /* USE_MCAST */ |
352 | 356 |
|
353 | 357 |
#if 0 |
... | ... |
@@ -30,6 +30,8 @@ |
30 | 30 |
* 2003-02-10 undoed the above changes (andrei) |
31 | 31 |
* 2003-03-19 replaced all the mallocs/frees w/ pkg_malloc/pkg_free (andrei) |
32 | 32 |
* 2003-04-14 set sockopts to TOS low delay (andrei) |
33 |
+ * 2004-05-03 applied multicast support patch from janakj |
|
34 |
+ * added set multicast ttl support (andrei) |
|
33 | 35 |
*/ |
34 | 36 |
|
35 | 37 |
|
... | ... |
@@ -237,6 +239,14 @@ static int setup_mcast_rcvr(int sock, union sockaddr_union* addr) |
237 | 239 |
strerror(errno)); |
238 | 240 |
return -1; |
239 | 241 |
} |
242 |
+ if (mcast_ttl>=0){ |
|
243 |
+ if (setsockopt(sock, IPPROTO_IP, IP_MULTICAST_TTL, &mcast_ttl, |
|
244 |
+ sizeof(mcast_ttl))==-1){ |
|
245 |
+ LOG(L_ERR, "ERROR: setup_mcast_rcvr: setosckopt (ttl):" |
|
246 |
+ " %s\n", strerror(errno)); |
|
247 |
+ return -1; |
|
248 |
+ } |
|
249 |
+ } |
|
240 | 250 |
#ifdef USE_IPV6 |
241 | 251 |
} else if (addr->s.sa_family==AF_INET6){ |
242 | 252 |
memcpy(&mreq6.ipv6mr_multiaddr, &addr->sin6.sin6_addr, |
... | ... |
@@ -256,6 +266,14 @@ static int setup_mcast_rcvr(int sock, union sockaddr_union* addr) |
256 | 266 |
strerror(errno)); |
257 | 267 |
return -1; |
258 | 268 |
} |
269 |
+ if (mcast_ttl>=0){ |
|
270 |
+ if (setsockopt(sock, IPPROTO_IP, IPV6_MULTICAST_HOPS, &mcast_ttl, |
|
271 |
+ sizeof(mcast_ttl))==-1){ |
|
272 |
+ LOG(L_ERR, "ERROR: setup_mcast_rcvr: setosckopt (ttlv6):" |
|
273 |
+ " %s\n", strerror(errno)); |
|
274 |
+ return -1; |
|
275 |
+ } |
|
276 |
+ } |
|
259 | 277 |
#endif /* USE_IPV6 */ |
260 | 278 |
} else { |
261 | 279 |
LOG(L_ERR, "ERROR: udp_init: Unsupported protocol family\n"); |