<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="generator" content="Osso Notes">
<title></title></head>
<body>
<p>
<br>Hi,
<br>
<br>I haven't forgotten about this, I just wanted to refactor the transport selection logic out of the source/destination driver.
<br>
<br>The patch otherwise looks ok, and I'll either fold it into the refactor stuff or merge on its own if I can't do the refactor.
<br>
<br>Thanks.
<br>
<br>----- Original message -----
<br>> To make it easy to set up IPv6 sources or destinations, the network()
<br>> driver should have an option to select the IP protocol. This patch
<br>> does just that, in the form of an ip-protocol() option, which allows
<br>> one to select either IPv4 or IPv6.
<br>>
<br>> In the end, this allows us to have a source as follows:
<br>>
<br>> source s_v6_syslog {
<br>>  network(port(12345)
<br>>  transport(framed)
<br>>  ip-protocol(6));
<br>> };
<br>>
<br>> The option is available for both the source and destination version of
<br>> network().
<br>>
<br>> Signed-off-by: Gergely Nagy <<a href="mailto:algernon@balabit.hu">algernon@balabit.hu</a>>
<br>> ---
<br>>  modules/afsocket/afsocket-grammar.ym |  29
<br>> ++++++++++++++++++++++++++++- modules/afsocket/afsocket-parser.c  |  
<br>> 1 + 2 files changed, 29 insertions(+), 1 deletion(-)
<br>>
<br>> diff --git a/modules/afsocket/afsocket-grammar.ym
<br>> b/modules/afsocket/afsocket-grammar.ym index 7beb6e8..464d5d8 100644
<br>> --- a/modules/afsocket/afsocket-grammar.ym
<br>> +++ b/modules/afsocket/afsocket-grammar.ym
<br>> @@ -79,6 +79,7 @@ TLSContext *last_tls_context;
<br>>  %token KW_UDP6
<br>>  %token KW_NETWORK
<br>>  %token KW_TRANSPORT
<br>> +%token KW_IP_PROTOCOL
<br>>  
<br>>  %token KW_IP_TTL
<br>>  %token KW_SO_BROADCAST
<br>> @@ -136,6 +137,8 @@ TLSContext *last_tls_context;
<br>>  %type  <ptr> dest_afnetwork
<br>>  %type  <ptr> dest_afnetwork_params
<br>>  
<br>> +%type  <num> afinet_ip_protocol_option
<br>> +
<br>>  %%
<br>>  
<br>>  start
<br>> @@ -149,6 +152,25 @@ start
<br>>  | LL_CONTEXT_DESTINATION dest_afnetwork  {
<br>> YYACCEPT; }  ;
<br>>  
<br>> +afinet_ip_protocol_option
<br>> +  : LL_NUMBER
<br>> +  {
<br>> +  CHECK_ERROR($1 == 4 || $1 == 6, @1, "ip-protocol option can
<br>> only be 4 or 6!"); +  if ($1 == 4)
<br>> +  {
<br>> +  $$ = AF_INET;
<br>> +  }
<br>> +  else
<br>> +  {
<br>> +  $$ = AF_INET6;
<br>> +  }
<br>> +  }
<br>> +  ;
<br>> +
<br>> +source_afinet_ip_protocol
<br>> +  : KW_IP_PROTOCOL '(' afinet_ip_protocol_option ')' {
<br>> ((AFSocketSourceDriver *)last_driver)->address_family = $3; } +  ;
<br>> +  
<br>>  source_afunix
<br>>  : KW_UNIX_DGRAM '(' source_afunix_dgram_params ')'  
<br>>  { $$ = $3; } | KW_UNIX_STREAM '('
<br>> source_afunix_stream_params ')'  { $$ =
<br>> $3; } @@ -314,6 +336,7 @@ source_afnetwork_option  :
<br>> source_afinet_option  | source_afsocket_transport
<br>>   | source_afsocket_stream_params {}
<br>> +  | source_afinet_ip_protocol
<br>>   ;
<br>>  
<br>>  source_afsocket_transport
<br>> @@ -335,7 +358,10 @@ source_afsocket_transport
<br>>  }
<br>>  ;
<br>>  
<br>> -
<br>> +dest_afinet_ip_protocol
<br>> +  : KW_IP_PROTOCOL '(' afinet_ip_protocol_option ')' {
<br>> ((AFSocketDestDriver *)last_driver)->address_family = $3; } +  ;
<br>> +  
<br>>  dest_afunix
<br>>   : KW_UNIX_DGRAM '(' dest_afunix_dgram_params ')' { $$ = $3; }
<br>>   | KW_UNIX_STREAM '(' dest_afunix_stream_params ')' { $$ = $3; }
<br>> @@ -500,6 +526,7 @@ dest_afnetwork_options
<br>>  dest_afnetwork_option
<br>>   : dest_afinet_option
<br>>   | dest_afsocket_transport
<br>> +  | dest_afinet_ip_protocol
<br>>   ;
<br>>  
<br>>  dest_afsocket_transport
<br>> diff --git a/modules/afsocket/afsocket-parser.c
<br>> b/modules/afsocket/afsocket-parser.c index 4065d31..f9e14a4 100644
<br>> --- a/modules/afsocket/afsocket-parser.c
<br>> +++ b/modules/afsocket/afsocket-parser.c
<br>> @@ -72,6 +72,7 @@ static CfgLexerKeyword afsocket_keywords[] = {
<br>>  { "tcp_keepalive_intvl", KW_TCP_KEEPALIVE_INTVL, 0x0304 },
<br>>  { "spoof_source",  KW_SPOOF_SOURCE },
<br>>  { "transport",  KW_TRANSPORT },
<br>> +  { "ip_protocol",  KW_IP_PROTOCOL },
<br>>  { "max_connections",  KW_MAX_CONNECTIONS },
<br>>  { "keep_alive",  KW_KEEP_ALIVE },
<br>>  { NULL }
<br>> --
<br>> 1.7.10.4
<br>>
<br>>
<br>> ______________________________________________________________________________
<br>> Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a>
<br>> Documentation:
<br>> <a href="http://www.balabit.com/support/documentation/?product=syslog-ng">http://www.balabit.com/support/documentation/?product=syslog-ng</a> FAQ:
<br>> <a href="http://www.balabit.com/wiki/syslog-ng-faq">http://www.balabit.com/wiki/syslog-ng-faq</a>
<br>>
<br><br></p>
</body>
</html>