Date: Sat, 18 Apr 2009 20:30:05 GMT From: "Alexander V. Chernikov" <melifaro@ipfw.ru> To: freebsd-ports-bugs@FreeBSD.org Subject: Re: ports/133031: ports/net/igmpproxy "must be at least 2 Vif's where one is upstream" +solve(?) Message-ID: <200904182030.n3IKU5rw018883@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/133031; it has been noted by GNATS. From: "Alexander V. Chernikov" <melifaro@ipfw.ru> To: bug-followup@FreeBSD.org Cc: Subject: Re: ports/133031: ports/net/igmpproxy "must be at least 2 Vif's where one is upstream" +solve(?) Date: Sun, 19 Apr 2009 00:02:23 +0400 This is a multi-part message in MIME format. --------------010802010909030500050807 Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit Unfortunately I'm unable to reproduce an issue with interface names on my 7.1-STABLE amd64 router. I've tried with nearly same configuration (xl* instead of fxp* and vlan* as long name interfaces). Thanks for pointing out problem with malloc(). Please try an attached patch and let me know if it resolves your issue. -- WBR, Alexander V. Chernikov MELI-RIPE --------------010802010909030500050807 Content-Type: text/plain; name="upd.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="upd.txt" --- Makefile.orig 2009-04-18 23:55:32.000000000 +0400 +++ Makefile 2009-04-18 23:56:16.000000000 +0400 @@ -7,6 +7,7 @@ PORTNAME= igmpproxy PORTVERSION= 0.1 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= ${PORTNAME} --- files/patch-freebsd.orig 2009-03-18 18:18:53.000000000 +0300 +++ files/patch-freebsd 2009-04-18 23:11:47.000000000 +0400 @@ -30,8 +30,31 @@ build.h : echo '#define BUILD "' `date +%y%m%d` '"' >build.h ---- src/config.c.orig 2005-05-24 16:49:29.000000000 +0100 -+++ src/config.c 2009-03-18 14:35:31.000000000 +0000 +--- src/config.c.orig 2005-05-24 19:49:29.000000000 +0400 ++++ src/config.c 2009-04-18 23:11:35.000000000 +0400 +@@ -39,16 +39,16 @@ + + // Structure to keep configuration for VIFs... + struct vifconfig { +- char* name; +- short state; +- int ratelimit; +- int threshold; ++ char name[IFNAMSIZ]; ++ short state; ++ int ratelimit; ++ int threshold; + + // Keep allowed nets for VIF. +- struct SubnetList* allowednets; ++ struct SubnetList* allowednets; + + // Next config in list... +- struct vifconfig* next; ++ struct vifconfig* next; + }; + + // Structure to keep vif configuration @@ -177,7 +177,7 @@ } @@ -41,7 +64,21 @@ if ( Dp->InAdr.s_addr && ! (Dp->Flags & IFF_LOOPBACK) ) { // Now try to find a matching config... -@@ -255,7 +255,7 @@ +@@ -240,12 +240,7 @@ + tmpPtr->state = IF_STATE_DOWNSTREAM; + tmpPtr->allowednets = NULL; + +- // Make a copy of the token to store the IF name +- tmpPtr->name = (char *)malloc( sizeof(char) * strlen(token) ); +- if(tmpPtr->name == NULL) { +- log(LOG_ERR, 0, "Out of memory."); +- } +- strcpy(tmpPtr->name, token); ++ strlcpy(tmpPtr->name, token, sizeof(tmpPtr->name)); + + // Set the altnet pointer to the allowednets pointer. + anetPtr = &tmpPtr->allowednets; +@@ -255,7 +250,7 @@ while(token != NULL) { if(strcmp("altnet", token)==0) { // Altnet... @@ -50,7 +87,7 @@ token = nextConfigToken(); IF_DEBUG log(LOG_DEBUG, 0, "Config: IF: Got altnet token %s.",token); -@@ -347,7 +347,7 @@ +@@ -347,7 +342,7 @@ mask <<= (32 - bitcnt); } @@ -59,8 +96,8 @@ log(LOG_WARNING, 0, "Unable to parse address token '%s'.", addrstr); return NULL; } ---- src/defs.h.orig 2005-08-20 13:44:47.000000000 +0100 -+++ src/defs.h 2009-03-18 14:35:31.000000000 +0000 +--- src/defs.h.orig 2005-08-20 16:44:47.000000000 +0400 ++++ src/defs.h 2009-04-18 22:57:06.000000000 +0400 @@ -40,10 +40,18 @@ #include <stdlib.h> #include <syslog.h> @@ -154,6 +191,15 @@ /* ifvc.c */ +@@ -161,7 +206,7 @@ + }; + + struct IfDesc { +- char Name[ sizeof( ((struct ifreq *)NULL)->ifr_name ) ]; ++ char Name[IFNAMSIZ]; + struct in_addr InAdr; /* == 0 for non IP interfaces */ + short Flags; + short state; @@ -196,6 +241,7 @@ struct IfDesc *getIfByName( const char *IfName ); struct IfDesc *getIfByIx( unsigned Ix ); --------------010802010909030500050807--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904182030.n3IKU5rw018883>