Tim Spriggs wrote:
Hello,
I'm trying to deploy CFengine in our organization over IPv6. So
far, Solaris works pretty well (still debugging random disconnects)
but Darwin refuses to see an IPv6 host running cfserv. After digging a
little bit in the source I found that it was intentionally crippled
but I can not find a reason for this. I un-crippled the source and
re-built on Tiger and Leopard and communication with the cfserv host
seems to work just fine.
I've attached a patch created from the trunk of the svn repository.
I hope that this patch can be included to future updates of cfengine2.
Thanks,
-Tim
Index: src/proto.c
===================================================================
--- src/proto.c (revision 511)
+++ src/proto.c (working copy)
@@ -69,7 +69,7 @@
int len,err;
struct passwd *user_ptr;
char *uname;
-#if defined(HAVE_GETADDRINFO) && !defined(DARWIN)
+#if defined(HAVE_GETADDRINFO)
char myaddr[256]; /* Compilation trick for systems that don't know ipv6 */
#else
struct sockaddr_in myaddr;
@@ -96,7 +96,7 @@
{
case AF_INET: len = sizeof(struct sockaddr_in);
break;
-#if defined(HAVE_GETADDRINFO) && !defined(DARWIN)
+#if defined(HAVE_GETADDRINFO)
case AF_INET6: len = sizeof(struct sockaddr_in6);
break;
#endif
@@ -114,7 +114,7 @@
Debug("Identifying this agent as %s i.e. %s, with signature
%d\n",localip,VFQNAME,CFSIGNATURE);
-#if defined(HAVE_GETADDRINFO) && !defined(DARWIN)
+#if defined(HAVE_GETADDRINFO)
if ((err=getnameinfo((struct sockaddr
*)&myaddr,len,dnsname,CF_MAXVARSIZE,NULL,0,0)) != 0)
{
Index: src/ip.c
===================================================================
--- src/ip.c (revision 511)
+++ src/ip.c (working copy)
@@ -40,7 +40,7 @@
{ int err;
-#if defined(HAVE_GETADDRINFO) && !defined(DARWIN)
+#if defined(HAVE_GETADDRINFO)
if (forceipv4 == 'n')
{
Index: src/ipname.c
===================================================================
--- src/ipname.c (revision 511)
+++ src/ipname.c (working copy)
@@ -58,7 +58,7 @@
{ static char ipbuffer[CF_SMALLBUF];
int err;
-#if defined(HAVE_GETADDRINFO) && !defined(DARWIN)
+#if defined(HAVE_GETADDRINFO)
struct addrinfo query, *response, *ap;
@@ -115,7 +115,7 @@
{ static char hostbuffer[MAXHOSTNAMELEN];
int err;
-#if defined(HAVE_GETADDRINFO) && !defined(DARWIN)
+#if defined(HAVE_GETADDRINFO)
struct addrinfo query, *response, *ap;
Index: src/cfservd.c
===================================================================
--- src/cfservd.c (revision 511)
+++ src/cfservd.c (working copy)
@@ -552,7 +552,7 @@
struct timeval timeout;
int ret_val;
-#if defined(HAVE_GETADDRINFO) && !defined(DARWIN)
+#if defined(HAVE_GETADDRINFO)
int addrlen=sizeof(struct sockaddr_in6);
struct sockaddr_in6 cin;
#else
@@ -757,7 +757,7 @@
char *ptr = NULL;
struct linger cflinger;
-#if defined(HAVE_GETADDRINFO) && !defined(DARWIN)
+#if defined(HAVE_GETADDRINFO)
struct addrinfo query,*response,*ap;
#else
struct sockaddr_in sin;
@@ -766,7 +766,7 @@
cflinger.l_onoff = 1;
cflinger.l_linger = 60;
-#if defined(HAVE_GETADDRINFO) && !defined(DARWIN)
+#if defined(HAVE_GETADDRINFO)
memset(&query,0,sizeof(struct addrinfo));
@@ -1810,7 +1810,7 @@
char dns_assert[CF_MAXVARSIZE],ip_assert[CF_MAXVARSIZE];
int matched = false;
struct passwd *pw;
-#if defined(HAVE_GETADDRINFO) && !defined(DARWIN)
+#if defined(HAVE_GETADDRINFO)
struct addrinfo query, *response=NULL, *ap;
int err;
#else
@@ -1888,7 +1888,7 @@
/* Do a reverse DNS lookup, like tcp wrappers to see if hostname matches IP */
-#if defined(HAVE_GETADDRINFO) && !defined(DARWIN)
+#if defined(HAVE_GETADDRINFO)
Debug("Using v6 compatible lookup...\n");
Index: src/item.c
===================================================================
--- src/item.c (revision 511)
+++ src/item.c (working copy)
@@ -933,7 +933,7 @@
}
}
-#if defined(HAVE_GETADDRINFO) && !defined(DARWIN)
+#if defined(HAVE_GETADDRINFO)
if (isv6)
{
struct sockaddr_in6 addr1,addr2;
Index: src/cflex.c
===================================================================
--- src/cflex.c (revision 511)
+++ src/cflex.c (working copy)
@@ -345,6 +345,9 @@
typedef int yy_state_type;
extern int yylineno;
+
+int yylineno = 1;
+
extern char *yytext;
#define yytext_ptr yytext
@@ -3229,7 +3232,7 @@
/* Note the %o %a declarations to allow more internal workspace */
-#line 3233 "lex.yy.c"
+#line 3236 "lex.yy.c"
#define INITIAL 0
#define INCONTROL 1
@@ -3390,7 +3393,7 @@
-#line 3394 "lex.yy.c"
+#line 3397 "lex.yy.c"
if ( !(yy_init) )
{
@@ -4019,7 +4022,7 @@
#line 520 "cflex.l"
ECHO;
YY_BREAK
-#line 4023 "lex.yy.c"
+#line 4026 "lex.yy.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(INCONTROL):
case YY_STATE_EOF(BRACELIST):
@@ -4429,7 +4432,7 @@
case EOB_ACT_END_OF_FILE:
{
if ( yywrap( ) )
- return EOF;
+ return 0;
if ( ! (yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
@@ -4833,6 +4836,15 @@
/* Accessor methods (get/set functions) to struct members. */
+/** Get the current line number.
+ *
+ */
+int yyget_lineno (void)
+{
+
+ return yylineno;
+}
+
/** Get the input stream.
*
*/
@@ -4866,6 +4878,16 @@
return yytext;
}
+/** Set the current line number.
+ * @param line_number
+ *
+ */
+void yyset_lineno (int line_number )
+{
+
+ yylineno = line_number;
+}
+
/** Set the input stream. This does not discard the current
* input buffer.
* @param in_str A readable stream.
Index: src/cfparse.c
===================================================================
--- src/cfparse.c (revision 511)
+++ src/cfparse.c (working copy)
@@ -249,7 +249,7 @@
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
-# if YYENABLE_NLS
+# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -746,7 +746,7 @@
we won't break user code: when these are the locations we know. */
#ifndef YY_LOCATION_PRINT
-# if YYLTYPE_IS_TRIVIAL
+# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \
Index: src/sockaddr.c
===================================================================
--- src/sockaddr.c (revision 511)
+++ src/sockaddr.c (working copy)
@@ -52,7 +52,7 @@
char *sockaddr_ntop(struct sockaddr *sa)
{
-#if defined(HAVE_GETADDRINFO) && !defined(DARWIN)
+#if defined(HAVE_GETADDRINFO)
static char addrbuf[INET6_ADDRSTRLEN];
void *addr;
#else
@@ -74,7 +74,7 @@
break;
#endif
-#if defined(HAVE_GETADDRINFO) && !defined(DARWIN)
+#if defined(HAVE_GETADDRINFO)
case AF_INET6:
Debug("IPV6 address\n");
addr = &((struct sockaddr_in6 *)sa)->sin6_addr;
@@ -109,7 +109,7 @@
void *sockaddr_pton(int af,void *src)
{ int err;
-#if defined(HAVE_GETADDRINFO) && !defined(DARWIN)
+#if defined(HAVE_GETADDRINFO)
static struct sockaddr_in6 adr6;
#endif
static struct sockaddr_in adr;
@@ -123,7 +123,7 @@
Debug("Coded ipv4 %s\n",sockaddr_ntop((struct sockaddr *)&adr));
return (void *)&adr;
-#if defined(HAVE_GETADDRINFO) && !defined(DARWIN)
+#if defined(HAVE_GETADDRINFO)
case AF_INET6:
memset(&adr6,0,sizeof(adr6));
adr6.sin6_family = AF_INET6;
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine