openslp-devel Mailing List for OpenSLP (Page 6)
Brought to you by:
jcalcote
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(33) |
Jun
(18) |
Jul
(14) |
Aug
(14) |
Sep
(116) |
Oct
(65) |
Nov
(28) |
Dec
(64) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(10) |
Feb
(23) |
Mar
(26) |
Apr
(14) |
May
(4) |
Jun
(18) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(11) |
Nov
(9) |
Dec
(4) |
| 2002 |
Jan
(15) |
Feb
(6) |
Mar
(14) |
Apr
(11) |
May
(15) |
Jun
(12) |
Jul
(4) |
Aug
(23) |
Sep
(12) |
Oct
(1) |
Nov
(20) |
Dec
(29) |
| 2003 |
Jan
(23) |
Feb
(42) |
Mar
(33) |
Apr
(11) |
May
(4) |
Jun
(16) |
Jul
(34) |
Aug
(12) |
Sep
(6) |
Oct
(3) |
Nov
(2) |
Dec
(5) |
| 2004 |
Jan
(7) |
Feb
(6) |
Mar
(2) |
Apr
(9) |
May
(4) |
Jun
(7) |
Jul
(2) |
Aug
(14) |
Sep
(8) |
Oct
(2) |
Nov
(10) |
Dec
(7) |
| 2005 |
Jan
(1) |
Feb
(3) |
Mar
(6) |
Apr
(2) |
May
(5) |
Jun
(4) |
Jul
(8) |
Aug
(11) |
Sep
(3) |
Oct
(2) |
Nov
(3) |
Dec
(2) |
| 2006 |
Jan
(3) |
Feb
(1) |
Mar
(12) |
Apr
(28) |
May
(11) |
Jun
(29) |
Jul
(15) |
Aug
(38) |
Sep
(12) |
Oct
(41) |
Nov
(77) |
Dec
(31) |
| 2007 |
Jan
(4) |
Feb
(10) |
Mar
(4) |
Apr
(3) |
May
(1) |
Jun
|
Jul
(4) |
Aug
|
Sep
(5) |
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
(14) |
Mar
(9) |
Apr
(4) |
May
(3) |
Jun
(4) |
Jul
(18) |
Aug
(12) |
Sep
(2) |
Oct
(5) |
Nov
|
Dec
|
| 2009 |
Jan
(1) |
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
(1) |
Feb
|
Mar
(4) |
Apr
(5) |
May
(1) |
Jun
|
Jul
(28) |
Aug
(30) |
Sep
(17) |
Oct
(12) |
Nov
(13) |
Dec
(17) |
| 2011 |
Jan
|
Feb
|
Mar
(7) |
Apr
(2) |
May
(19) |
Jun
(7) |
Jul
(18) |
Aug
(21) |
Sep
(13) |
Oct
(2) |
Nov
(4) |
Dec
(4) |
| 2012 |
Jan
(3) |
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(6) |
Aug
(3) |
Sep
(25) |
Oct
(30) |
Nov
(39) |
Dec
(12) |
| 2013 |
Jan
(9) |
Feb
(3) |
Mar
(4) |
Apr
|
May
|
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
(3) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
(5) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
| 2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2023 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: HIRD M. <Mat...@uk...> - 2012-09-20 10:00:50
|
If it is falling back to multicast, what does your routing table look like? From: Nick Wagner [mailto:ne...@wi...] Sent: 19 September 2012 23:56 To: Jim Marshall Cc: ope...@li... Subject: Re: [Openslp-devel] slptool displays multiple attributes when only 1 should be I'm not sure. I had issues in the past with openslp & multicast, in that even after the question was answered, slptool/libslp would still keep trying. This makes sense on the findsrvs front, as we want to make sure we've discovered everything, but on the findattrs front a single answer for that service is fine with me. In any case, I think this may be more of a release oddity than any real bug. --Nick On Wed, Sep 19, 2012 at 1:56 PM, Jim Marshall <jim...@wb...<mailto:jim...@wb...>> wrote: Nick Wagner wrote: If there is no DA, these would be multicast requests. I think what's happening is that slptool does the request for attributes multiple times via multicast, and getting a response each time. I'm apparently not in a position to recreate this -- could you sniff it? I can sniff it with WireShark, what am I looking for? My machine does have 3 'NIC's (1 wired, and 2 virtual from VMware player), as a test I enabled my wireless adapter and now I get four responses from the 'findattrs' operation. So it appears you are correct, however; I thought I told slpd to just use the main IP. in my slp.conf I have the following entry net.slp.interfaces = 192.168.5.101 should that prevent this issue - I restarted slpd with the '-c' command line option? |
|
From: Nick W. <ne...@wi...> - 2012-09-19 22:55:57
|
I'm not sure. I had issues in the past with openslp & multicast, in that even after the question was answered, slptool/libslp would still keep trying. This makes sense on the findsrvs front, as we want to make sure we've discovered everything, but on the findattrs front a single answer for that service is fine with me. In any case, I think this may be more of a release oddity than any real bug. --Nick On Wed, Sep 19, 2012 at 1:56 PM, Jim Marshall < jim...@wb...> wrote: > Nick Wagner wrote: > > If there is no DA, these would be multicast requests. I think what's > happening is that slptool does the request for attributes multiple times > via multicast, and getting a response each time. I'm apparently not in a > position to recreate this -- could you sniff it? > > I can sniff it with WireShark, what am I looking for? > > My machine does have 3 'NIC's (1 wired, and 2 virtual from VMware player), > as a test I enabled my wireless adapter and now I get four responses from > the 'findattrs' operation. So it appears you are correct, however; I > thought I told slpd to just use the main IP. in my slp.conf I have the > following entry > > net.slp.interfaces = 192.168.5.101 > > should that prevent this issue - I restarted slpd with the '-c' command > line option? > > |
|
From: Nick W. <ne...@wi...> - 2012-09-19 18:23:47
|
On Wed, Sep 19, 2012 at 1:14 PM, Nick Wagner <ne...@wi...> wrote: > If there is no DA, these would be multicast requests. I think what's > happening is that slptool does the request for attributes multiple times > via multicast, and getting a response each time. I'm apparently not in a > position to recreate this -- could you sniff it? > > --Nick > > > On Wed, Sep 19, 2012 at 12:25 PM, Jim Marshall < > jim...@wb...> wrote: > >> Nick Wagner wrote: >> >> Sorry to take so long with this. I tried the trunk code on my machine >> (xp with vs2010), and couldn't replicate the problem. Do you have a DA >> running? Could this be dropping to multicast somehow? >> >> I believe we only have SA's running on our network. Doing a >> >> slpd findsrvs service:directory-agent >> >> returns nothing but 'service:service-agent' returns 8 entries. >> >> How can I tell if it is dropping to multicast? >> >> Thanks >> >> |
|
From: Nick W. <ne...@wi...> - 2012-09-19 16:07:11
|
It appears that SLPDDatabaseReg doesn't initialize slpifaces correctly. Please double-check all uses of SLPIfaceGetInfo and the SLPIfaceInfo structure. Otherwise, I'm fine with this patch --Nick On Wed, Sep 12, 2012 at 10:49 AM, gowrishankar < gow...@li...> wrote: > Hi David, > > On Wednesday 12 September 2012 07:39 PM, David Stevens wrote: > > Gowri, > > Thanks for the review. > > > > gowrishankar<gow...@li...> wrote on 09/11/2012 > > 10:21:32 PM: > > > >>> +# > >>> +# If operating as an SA or DA, this specifies the maximum number > >> of interfaces > >>> +# that can be active. (Default is 100) > >> MAX_IFACE_LEN is 20. > >> > > My patch does not use or change MAX_IFACE_LEN. I don't > > understand this comment. Are you suggesting a code change? > > Oops, you are correct David. please ignore this suggestion. > > Thanks, > Gowri Shankar > > thanks, > > > > +-DLS > > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Openslp-devel mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openslp-devel > |
|
From: Jim M. <jim...@wb...> - 2012-09-17 16:51:31
|
Hi, I am testing the trunk on Windows 7, code was built with Visual Studio 11 (Beta of VS 2012). When doing a simple test to register a service and then get its attributes I am getting back multiple 'entries' when only 1 such entry exists. This appears to be an issue with the 2.0 slptool because if I use the older slptool 1.0.9.a on the same registration I only get a single attribute back. slptool example: C:\Temp\openslp\win32\Win32\Debug>slptool -v slptool version = 2.0.0 libslp version = 2.0.0 libslp configuration file = (null) C:\Temp\openslp\win32\Win32\Debug>slptool.exe register service:myserv.x://myhost.com "(attr1=val1),(attr2=val2)" C:\Temp\openslp\win32\Win32\Debug>slptool findsrvs service:myserv.x service:myserv.x://myhost.com,10785 C:\Temp\openslp\win32\Win32\Debug>slptool findattrs service:myserv.x://myhost.com (attr1=val1),(attr2=val2) (attr1=val1),(attr2=val2) (attr1=val1),(attr2=val2) C:\Temp\openslp\win32\Win32\Debug>slptool findattrs service:myserv.x://myhost.com attr1 (attr1=val1) (attr1=val1) (attr1=val1) Server Info: C:\Temp\openslp\win32\Win32\Debug>slpd -v slpd version: 2.0.0 compile options: debugging: disabled predicates: enabled slpv1 compatability: enabled slpv2 security: disabled C:\Temp\linux64\openslp\win32\Win32\Debug>slpd -stop C:\Temp\linux64\openslp\win32\Win32\Debug>slpd -start -- mail Jim Marshall Sr. Software Engineer WS <http://ws-inc.com/> |
|
From: Jim M. <jim...@wb...> - 2012-09-14 17:41:17
|
Ian Norton wrote:
> slp.h:
>
> SLP_NETWORK_TIMED_OUT = -19
>
> Are you running slpd of the right version?
Yes slpd 2.0 is running and as an aside the 1.x version runs fine
C:\Temp\openslp\win32\Win32\Debug>slpd -install
Service Location Protocol installed.
C:\Temp\openslp\win32\Win32\Debug>slpd.exe -version
slpd version: 2.0.0
compile options:
debugging: disabled
predicates: enabled
slpv1 compatability: enabled
slpv2 security: disabled
>
> On 14 September 2012 17:55, Ian Norton <in...@gm...
> <mailto:in...@gm...>> wrote:
>
> I seem to recall that -19 means that you couldnt contact the slpd
> process.
>
>
> On 14 September 2012 16:56, Jim Marshall
> <jim...@wb...
> <mailto:jim...@wb...>> wrote:
>
> Hi,
> We've written a test script to test the basic functionality
> of OpenSLP
> (basic sanity check stuff), it works fine with the older SLP
> (1.0.9a). I
> grabbed the trunk and built it on Windows 7 (with VS 2011
> Beta), it
> builds fine and slpd installs and runs. using slptool to perfrom a
> findsrvs operation works, however; when I try to manually
> register a
> service with slptool I get error "-19":
>
> C:\Temp\openslp\win32\Win32\Debug>slptool register
> service:myserv.x://myhost.com <http://myhost.com>
> "(attr1=val1),(attr2=val2)"
> errorcode: -19
>
> What am I doing wrong?
>
> Additionally I brought the svn tree to a Linux (CentOS 5.5, 64bit)
> machine, it will not build. I run autogen.sh and it spits out
> an error
> regarding AC_USE_SYSTEM_EXTENSIONS but the configure script is
> generated. When I run the configure script I get the following
> error:
>
> ./configure --prefix=/home/jmars/trees/openslp/
> configure: error: cannot find install-sh or install.sh in .
> ./.. ./../..
>
> autoconf version: 2.59
> automake version: 1.96
> libtool version: 1.5.22
> GNU Make version: 3.81
>
> any thoughts on what I am doing wrong here?
>
> Thank you
> --
> mail
> Jim Marshall
>
> Sr. Software Engineer
> WS <http://ws-inc.com/>
>
>
>
> ------------------------------------------------------------------------------
> Got visibility?
> Most devs has no idea what their production app looks like.
> Find out how fast your code is with AppDynamics Lite.
> http://ad.doubleclick.net/clk;262219671;13503038;y?
> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
> _______________________________________________
> Openslp-devel mailing list
> Ope...@li...
> <mailto:Ope...@li...>
> https://lists.sourceforge.net/lists/listinfo/openslp-devel
>
>
>
--
mail
Jim Marshall
Sr. Software Engineer
WS <http://ws-inc.com/>
|
|
From: Jim M. <jim...@wb...> - 2012-09-14 16:51:32
|
Hi, We've written a test script to test the basic functionality of OpenSLP (basic sanity check stuff), it works fine with the older SLP (1.0.9a). I grabbed the trunk and built it on Windows 7 (with VS 2011 Beta), it builds fine and slpd installs and runs. using slptool to perfrom a findsrvs operation works, however; when I try to manually register a service with slptool I get error "-19": C:\Temp\openslp\win32\Win32\Debug>slptool register service:myserv.x://myhost.com "(attr1=val1),(attr2=val2)" errorcode: -19 What am I doing wrong? Additionally I brought the svn tree to a Linux (CentOS 5.5, 64bit) machine, it will not build. I run autogen.sh and it spits out an error regarding AC_USE_SYSTEM_EXTENSIONS but the configure script is generated. When I run the configure script I get the following error: ./configure --prefix=/home/jmars/trees/openslp/ configure: error: cannot find install-sh or install.sh in . ./.. ./../.. autoconf version: 2.59 automake version: 1.96 libtool version: 1.5.22 GNU Make version: 3.81 any thoughts on what I am doing wrong here? Thank you -- mail Jim Marshall Sr. Software Engineer WS <http://ws-inc.com/> |
|
From: gowrishankar <gow...@li...> - 2012-09-12 15:49:56
|
Hi David, On Wednesday 12 September 2012 07:39 PM, David Stevens wrote: > Gowri, > Thanks for the review. > > gowrishankar<gow...@li...> wrote on 09/11/2012 > 10:21:32 PM: > >>> +# >>> +# If operating as an SA or DA, this specifies the maximum number >> of interfaces >>> +# that can be active. (Default is 100) >> MAX_IFACE_LEN is 20. >> > My patch does not use or change MAX_IFACE_LEN. I don't > understand this comment. Are you suggesting a code change? Oops, you are correct David. please ignore this suggestion. Thanks, Gowri Shankar > thanks, > > +-DLS > |
|
From: David S. <dls...@us...> - 2012-09-12 14:22:17
|
Gowri,
Thanks for the review.
gowrishankar <gow...@li...> wrote on 09/11/2012
10:21:32 PM:
> > +#
> > +# If operating as an SA or DA, this specifies the maximum number
> of interfaces
> > +# that can be active. (Default is 100)
>
> MAX_IFACE_LEN is 20.
>
My patch does not use or change MAX_IFACE_LEN. I don't
understand this comment. Are you suggesting a code change?
thanks,
+-DLS
|
|
From: gowrishankar <gow...@li...> - 2012-09-12 02:21:48
|
On Wednesday 12 September 2012 05:19 AM, David L Stevens wrote:
> [resubmission; can anyone review this?]
>
> We have customers who have a need to use SLP on systems that have more than
> current maximum number of interfaces (MAX_SLP_IFACES) of 100.
>
> The following patch converts the compile-time maximum to be a run-time
> configurable value to allow an administrator to increase it on systems with
> large numbers of interfaces.
>
> Signed-off-by: David L Stevens<dls...@us...>
>
> diff --git a/common/slp_iface.c b/common/slp_iface.c
> index 2563f8f..59bb72a 100644
> --- a/common/slp_iface.c
> +++ b/common/slp_iface.c
> @@ -55,6 +55,8 @@
> /** The max interface name lenght is 20 */
> #define MAX_IFACE_LEN 20
>
> +int slp_max_ifaces = SLP_MAX_IFACES;
> +
> /** Custom designed wrapper for inet_pton to allow<ip>%<iface> format
> *
> *
> @@ -352,7 +354,7 @@ static int SLPIfaceGetV6Addr(SLPIfaceInfo * ifaceinfo)
> if (getifaddrs(&ifaddrs))
> return -1;
>
> - for (ifa = ifaddrs; ifa&& ifaceinfo->iface_count< SLP_MAX_IFACES; ifa = ifa->ifa_next)
> + for (ifa = ifaddrs; ifa&& ifaceinfo->iface_count< slp_max_ifaces; ifa = ifa->ifa_next)
> {
> if(ifa->ifa_addr->sa_family != AF_INET6)
> continue;
> @@ -374,6 +376,11 @@ static int SLPIfaceGetV6Addr(SLPIfaceInfo * ifaceinfo)
> ++ifaceinfo->iface_count;
> }
> freeifaddrs(ifaddrs);
> + if (ifa)
> + {
> + errno = ENOBUFS;
> + return -1;
> + }
> return 0;
> }
>
> @@ -429,14 +436,18 @@ int sizeof_ifreq(struct ifreq* ifr)
> int SLPIfaceGetDefaultInfo(SLPIfaceInfo * ifaceinfo, int family)
> {
> sockfd_t fd;
> - struct ifreq ifrlist[SLP_MAX_IFACES];
> + struct ifreq *ifrlist;
> struct ifreq ifrflags;
> struct ifreq * ifr;
> struct sockaddr* sa;
> char * p;
>
> struct ifconf ifc;
> - ifc.ifc_len = sizeof(struct ifreq) * SLP_MAX_IFACES;
> + ifrlist = malloc(sizeof(struct ifreq) * slp_max_ifaces);
> + if (ifrlist == NULL) {
> + return -1;
> + }
> + ifc.ifc_len = sizeof(struct ifreq) * slp_max_ifaces;
> ifc.ifc_req = ifrlist;
>
> if ((family == AF_INET6) || (family == AF_UNSPEC))
> @@ -454,10 +465,11 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo * ifaceinfo, int family)
> #endif
> {
> closesocket(fd);
> + xfree(ifrlist);
> return -1;
> }
>
> - for (p = ifc.ifc_buf; p< ifc.ifc_buf + ifc.ifc_len&& ifaceinfo->iface_count< SLP_MAX_IFACES;)
> + for (p = ifc.ifc_buf; p< ifc.ifc_buf + ifc.ifc_len&& ifaceinfo->iface_count< slp_max_ifaces;)
> {
> ifr = (struct ifreq*) p;
> sa = (struct sockaddr*)&(ifr->ifr_addr);
> @@ -480,7 +492,7 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo * ifaceinfo, int family)
> }
>
> /* reset ifc_len for next get */
> - ifc.ifc_len = sizeof(struct ifreq) * SLP_MAX_IFACES;
> + ifc.ifc_len = sizeof(struct ifreq) * slp_max_ifaces;
>
> if ((family == AF_INET) || (family == AF_UNSPEC))
> {
> @@ -494,10 +506,11 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo * ifaceinfo, int family)
> #endif
> {
> closesocket(fd);
> + xfree(ifrlist);
> return -1;
> }
>
> - for (p = ifc.ifc_buf; p< ifc.ifc_buf + ifc.ifc_len&& ifaceinfo->iface_count< SLP_MAX_IFACES;)
> + for (p = ifc.ifc_buf; p< ifc.ifc_buf + ifc.ifc_len&& ifaceinfo->iface_count< slp_max_ifaces;)
> {
> ifr = (struct ifreq*) p;
> sa = (struct sockaddr*)&(ifr->ifr_addr);
> @@ -516,6 +529,7 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo * ifaceinfo, int family)
> closesocket(fd);
> }
> }
> + xfree(ifrlist);
> return 0;
> }
>
> @@ -572,7 +586,7 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo* ifaceinfo, int family)
> return (errno = WSAGetLastError()), -1;
> }
> plist = (SOCKET_ADDRESS_LIST*)buffer;
> - for (i = 0; i< plist->iAddressCount&& ifaceinfo->iface_count< SLP_MAX_IFACES; ++i)
> + for (i = 0; i< plist->iAddressCount&& ifaceinfo->iface_count< slp_max_ifaces; ++i)
> if ((plist->Address[i].lpSockaddr->sa_family == AF_INET6)&&
> (0 == GetV6Scope((struct sockaddr_in6*)plist->Address[i].lpSockaddr, NULL))&&
> /*Ignore Teredo and loopback pseudo-interfaces*/
> @@ -609,7 +623,7 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo* ifaceinfo, int family)
> return (errno = WSAGetLastError()), -1;
> }
> plist = (SOCKET_ADDRESS_LIST*)buffer;
> - for (i = 0; i< plist->iAddressCount&& ifaceinfo->iface_count< SLP_MAX_IFACES; ++i)
> + for (i = 0; i< plist->iAddressCount&& ifaceinfo->iface_count< slp_max_ifaces; ++i)
> if (plist->Address[i].lpSockaddr->sa_family == AF_INET)
> memcpy(&ifaceinfo->iface_addr[ifaceinfo->iface_count++],
> plist->Address[i].lpSockaddr, sizeof(struct sockaddr_in));
> @@ -1078,6 +1092,21 @@ int main(int argc, char * argv[])
> WSAStartup(MAKEWORD(2, 2),&wsadata);
> #endif
>
> + ifaceinfo.iface_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
> + if (ifaceinfo.iface_addr == NULL)
> + {
> + fprintf(stderr, "iface_addr malloc(%d) failed\n",
> + slp_max_ifaces * sizeof(struct sockaddr_storage));
> + exit(1);
> + }
> + ifaceinfo.bcast_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
> + if (ifaceinfo.bcast_addr == NULL)
> + {
> + fprintf(stderr, "bcast_addr malloc(%d) failed\n",
> + slp_max_ifaces * sizeof(struct sockaddr_storage));
> + exit(1);
> + }
> +
> if (SLPIfaceGetInfo(0,&ifaceinfo, AF_INET) == 0)
> for (i = 0; i< ifaceinfo.iface_count; i++)
> {
> @@ -1130,6 +1159,8 @@ int main(int argc, char * argv[])
> printf("sock addr string v6 = %s\n", addrstr);
> xfree(addrstr);
> }
> + xfree(ifaceinfo.iface_addr);
> + xfree(ifaceinfo.bcast_addr);
>
> #ifdef _WIN32
> WSACleanup();
> diff --git a/common/slp_iface.h b/common/slp_iface.h
> index e9bfd5a..ce0d111 100644
> --- a/common/slp_iface.h
> +++ b/common/slp_iface.h
> @@ -52,14 +52,15 @@
>
> /** The maximum number of interfaces we can handle. */
> #define SLP_MAX_IFACES 100
> +extern int slp_max_ifaces;
>
> /** Interface information structure */
> typedef struct _SLPInterfaceInfo
> {
> int iface_count;
> int bcast_count;
> - struct sockaddr_storage iface_addr[SLP_MAX_IFACES];
> - struct sockaddr_storage bcast_addr[SLP_MAX_IFACES];
> + struct sockaddr_storage *iface_addr;
> + struct sockaddr_storage *bcast_addr;
> } SLPIfaceInfo;
>
> int SLPIfaceGetInfo(char const * useifaces, SLPIfaceInfo * ifaceinfo,
> diff --git a/common/slp_xcast.c b/common/slp_xcast.c
> index b891769..3dca0dc 100644
> --- a/common/slp_xcast.c
> +++ b/common/slp_xcast.c
> @@ -371,6 +371,47 @@ int main(void)
> struct sockaddr_storage dst;
> int mtu;
>
> + socks.sock = malloc(slp_max_ifaces*sizeof(sockfd_t));
> + if (socks.sock == NULL)
> + {
> + fprintf(stderr, "socks.sock malloc(%d) failed\n",
> + slp_max_ifaces*sizeof(sockfd_t));
> + exit(1);
> + }
> + socks.peeraddr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage));
> + if (socks.peeraddr == NULL)
> + {
> + fprintf(stderr, "socks.peeraddr malloc(%d) failed\n",
> + slp_max_ifaces*sizeof(struct sockaddr_storage));
> + exit(1);
> + }
> + ifaceinfo.iface_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
> + if (ifaceinfo.iface_addr == NULL)
> + {
> + fprintf(stderr, "ifaceinfo.iface_addr malloc(%d) failed\n",
> + slp_max_ifaces*sizeof(struct sockaddr_storage));
> + exit(1);
> + }
> + ifaceinfo.bcast_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
> + if (ifaceinfo.bcast_addr == NULL)
> + {
> + fprintf(stderr, "ifaceinfo.bcast_addr malloc(%d) failed\n",
> + slp_max_ifaces*sizeof(struct sockaddr_storage));
> + exit(1);
> + }
> + ifaceinfo6.iface_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
> + if (ifaceinfo.bcast_addr == NULL)
> + {
> + fprintf(stderr, "ifaceinfo6.iface_addr malloc(%d) failed\n",
> + slp_max_ifaces*sizeof(struct sockaddr_storage));
> + exit(1);
> + }
> + ifaceinfo6.bcast_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
> + if (ifaceinfo.bcast_addr == NULL) {
> + fprintf(stderr, "ifaceinfo6.bcast_addr malloc(%d) failed\n",
> + slp_max_ifaces*sizeof(struct sockaddr_storage));
> + exit(1);
> + }
> #ifdef _WIN32
> WSADATA wsadata;
> WSAStartup(MAKEWORD(2, 2),&wsadata);
> @@ -409,6 +450,12 @@ int main(void)
>
> SLPBufferFree(buffer);
> }
> + xfree(ifaceinfo.iface_addr);
> + xfree(ifaceinfo.bcast_addr);
> + xfree(ifaceinfo6.iface_addr);
> + xfree(ifaceinfo6.bcast_addr);
> + xfree(socks.sock);
> + xfree(socks.peeraddr);
>
> #ifdef _WIN32
> WSACleanup();
> diff --git a/common/slp_xcast.h b/common/slp_xcast.h
> index c671b2b..49e4682 100644
> --- a/common/slp_xcast.h
> +++ b/common/slp_xcast.h
> @@ -57,10 +57,10 @@ typedef struct _SLPXcastSockets
> int sock_count;
>
> /** An array of sockets managed by this structure. */
> - sockfd_t sock[SLP_MAX_IFACES];
> + sockfd_t *sock;
>
> /** An array of addresses that matches each socket in the sock array. */
> - struct sockaddr_storage peeraddr[SLP_MAX_IFACES];
> + struct sockaddr_storage *peeraddr;
>
> } SLPXcastSockets;
>
> diff --git a/etc/slp.conf b/etc/slp.conf
> index be57e77..156b6d7 100644
> --- a/etc/slp.conf
> +++ b/etc/slp.conf
> @@ -148,6 +148,11 @@
> # A integer giving the network packet MTU in bytes. (Default is 1400)
> ;net.slp.MTU = 1400
>
> +#
> +# If operating as an SA or DA, this specifies the maximum number of interfaces
> +# that can be active. (Default is 100)
MAX_IFACE_LEN is 20.
Rest of the code changes are reviewed.
Thanks,
Gowri Shankar
> +;net.slp.max_ifaces = 100
> +
> # If operating as an SA or DA, then any local addresses that are going to be
> # used must be specified. Both IPv4 and IPv6 addresses may be specified.
> # Only link-local addresses can be used for IPv6 SLP multicast. Any
> diff --git a/libslp/libslp_network.c b/libslp/libslp_network.c
> index 2530bfe..cd10255 100644
> --- a/libslp/libslp_network.c
> +++ b/libslp/libslp_network.c
> @@ -828,6 +828,7 @@ SLPError NetworkMcastRqstRply(SLPHandleInfo * handle, void * buf,
> SLPIfaceInfo v4outifaceinfo;
> SLPIfaceInfo v6outifaceinfo;
> SLPXcastSockets xcastsocks;
> + int alistsize;
> int currIntf = 0;
> int requestSent;
>
> @@ -841,6 +842,16 @@ SLPError NetworkMcastRqstRply(SLPHandleInfo * handle, void * buf,
> /* save off a few things we don't want to recalculate */
> langtaglen = strlen(handle->langtag);
>
> + /* initialize pointers freed on error */
> + dstifaceinfo.iface_addr = NULL;
> + dstifaceinfo.bcast_addr = NULL;
> + v4outifaceinfo.iface_addr = NULL;
> + v4outifaceinfo.bcast_addr = NULL;
> + v6outifaceinfo.iface_addr = NULL;
> + v6outifaceinfo.bcast_addr = NULL;
> + xcastsocks.sock = NULL;
> + xcastsocks.peeraddr = NULL;
> +
> xid = SLPXidGenerate();
> mtu = SLPPropertyGetMTU();
> sendbuf = SLPBufferAlloc(mtu);
> @@ -850,9 +861,60 @@ SLPError NetworkMcastRqstRply(SLPHandleInfo * handle, void * buf,
> goto FINISHED;
> }
>
> + alistsize = slp_max_ifaces * sizeof(struct sockaddr_storage);
> +
> + dstifaceinfo.iface_count = 0;
> + dstifaceinfo.iface_addr = malloc(alistsize);
> + if (dstifaceinfo.iface_addr == NULL)
> + {
> + result = SLP_MEMORY_ALLOC_FAILED;
> + goto FINISHED;
> + }
> + dstifaceinfo.bcast_addr = malloc(alistsize);
> + if (dstifaceinfo.bcast_addr == NULL)
> + {
> + result = SLP_MEMORY_ALLOC_FAILED;
> + goto FINISHED;
> + }
> v4outifaceinfo.iface_count = 0;
> + v4outifaceinfo.iface_addr = malloc(alistsize);
> + if (v4outifaceinfo.iface_addr == NULL)
> + {
> + result = SLP_MEMORY_ALLOC_FAILED;
> + goto FINISHED;
> + }
> + v4outifaceinfo.bcast_addr = malloc(alistsize);
> + if (v4outifaceinfo.bcast_addr == NULL)
> + {
> + result = SLP_MEMORY_ALLOC_FAILED;
> + goto FINISHED;
> + }
> v6outifaceinfo.iface_count = 0;
> + v6outifaceinfo.iface_addr = malloc(alistsize);
> + if (v6outifaceinfo.iface_addr == NULL)
> + {
> + result = SLP_MEMORY_ALLOC_FAILED;
> + goto FINISHED;
> + }
> + v6outifaceinfo.bcast_addr = malloc(alistsize);
> + if (v6outifaceinfo.bcast_addr == NULL)
> + {
> + result = SLP_MEMORY_ALLOC_FAILED;
> + goto FINISHED;
> + }
> xcastsocks.sock_count = 0;
> + xcastsocks.sock = malloc(slp_max_ifaces * sizeof(sockfd_t));
> + if (xcastsocks.sock == NULL)
> + {
> + result = SLP_MEMORY_ALLOC_FAILED;
> + goto FINISHED;
> + }
> + xcastsocks.peeraddr = malloc(alistsize);
> + if (xcastsocks.peeraddr == NULL)
> + {
> + result = SLP_MEMORY_ALLOC_FAILED;
> + goto FINISHED;
> + }
>
> #if !defined(MI_NOT_SUPPORTED)
> /* Determine which multicast addresses to send to. */
> @@ -1168,6 +1230,14 @@ CLEANUP:
> SLPBufferFree(sendbuf);
> SLPBufferFree(recvbuf);
> SLPXcastSocketsClose(&xcastsocks);
> + xfree(xcastsocks.sock);
> + xfree(xcastsocks.peeraddr);
> + xfree(dstifaceinfo.iface_addr);
> + xfree(dstifaceinfo.bcast_addr);
> + xfree(v4outifaceinfo.iface_addr);
> + xfree(v4outifaceinfo.bcast_addr);
> + xfree(v6outifaceinfo.iface_addr);
> + xfree(v6outifaceinfo.bcast_addr);
>
> return result;
> }
> diff --git a/slpd/slpd_incoming.c b/slpd/slpd_incoming.c
> index 0371455..e427d22 100644
> --- a/slpd/slpd_incoming.c
> +++ b/slpd/slpd_incoming.c
> @@ -752,9 +752,26 @@ int SLPDIncomingInit(void)
> /* string in a safety way */
> /*---------------------------------------------------------------------*/
>
> + ifaces.iface_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage));
> + if (ifaces.iface_addr == NULL)
> + {
> + SLPDLog("can't allocate %d iface_addrs\n", slp_max_ifaces);
> + exit(1);
> + }
> + ifaces.bcast_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage));
> + if (ifaces.bcast_addr == NULL)
> + {
> + SLPDLog("can't allocate %d bcast_addrs\n", slp_max_ifaces);
> + exit(1);
> + }
> + ifaces.bcast_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage));
> if (G_SlpdProperty.interfaces != NULL)
> - SLPIfaceGetInfo(G_SlpdProperty.interfaces,&ifaces, AF_UNSPEC);
> - else
> + {
> + if (SLPIfaceGetInfo(G_SlpdProperty.interfaces,&ifaces, AF_UNSPEC)< 0) {
> + SLPDLog("SLPIfaceGetInfo failed: %s\n", strerror(errno));
> + exit(1);
> + }
> + } else
> ifaces.iface_count = 0;
>
> for (i = 0; i< ifaces.iface_count; i++)
> diff --git a/slpd/slpd_property.c b/slpd/slpd_property.c
> index 81b6a8e..f9c64bb 100644
> --- a/slpd/slpd_property.c
> +++ b/slpd/slpd_property.c
> @@ -66,6 +66,8 @@ void SLPDPropertyReinit(void)
> xfree(G_SlpdProperty.DAAddresses);
> xfree(G_SlpdProperty.interfaces);
> xfree(G_SlpdProperty.locale);
> + xfree(G_SlpdProperty.ifaceInfo.iface_addr);
> + xfree(G_SlpdProperty.ifaceInfo.bcast_addr);
>
> /* reinitialize property sub-system */
> (void)SLPPropertyReinit();
> @@ -149,7 +151,22 @@ void SLPDPropertyReinit(void)
> else if (SLPNetIsIPV6())
> family = AF_INET6;
>
> + slp_max_ifaces = SLPPropertyAsInteger("net.slp.max_ifaces");
> + if (slp_max_ifaces<= 0)
> + slp_max_ifaces = SLP_MAX_IFACES;
> myinterfaces = SLPPropertyXDup("net.slp.interfaces");
> + G_SlpdProperty.ifaceInfo.iface_addr = malloc(slp_max_ifaces *
> + sizeof(struct sockaddr_storage));
> + if (G_SlpdProperty.ifaceInfo.iface_addr == NULL)
> + {
> + SLPDLog("Cannot allocate iface_addr for %d addresses\n", slp_max_ifaces);
> + }
> + G_SlpdProperty.ifaceInfo.bcast_addr = malloc(slp_max_ifaces *
> + sizeof(struct sockaddr_storage));
> + if (G_SlpdProperty.ifaceInfo.bcast_addr == NULL)
> + {
> + SLPDLog("Cannot allocate bcast_addr for %d addresses\n", slp_max_ifaces);
> + }
> sts = SLPIfaceGetInfo(myinterfaces,&G_SlpdProperty.ifaceInfo, family);
> xfree(myinterfaces);
>
> @@ -246,6 +263,8 @@ void SLPDPropertyDeinit(void)
> xfree(G_SlpdProperty.indexedAttributes);
> #endif
> xfree(G_SlpdProperty.locale);
> + xfree(G_SlpdProperty.ifaceInfo.iface_addr);
> + xfree(G_SlpdProperty.ifaceInfo.bcast_addr);
>
> SLPPropertyExit();
> }
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Openslp-devel mailing list
> Ope...@li...
> https://lists.sourceforge.net/lists/listinfo/openslp-devel
>
|
|
From: David L S. <dls...@us...> - 2012-09-11 23:52:23
|
[resubmission; can anyone review this?]
We have customers who have a need to use SLP on systems that have more than
current maximum number of interfaces (MAX_SLP_IFACES) of 100.
The following patch converts the compile-time maximum to be a run-time
configurable value to allow an administrator to increase it on systems with
large numbers of interfaces.
Signed-off-by: David L Stevens <dls...@us...>
diff --git a/common/slp_iface.c b/common/slp_iface.c
index 2563f8f..59bb72a 100644
--- a/common/slp_iface.c
+++ b/common/slp_iface.c
@@ -55,6 +55,8 @@
/** The max interface name lenght is 20 */
#define MAX_IFACE_LEN 20
+int slp_max_ifaces = SLP_MAX_IFACES;
+
/** Custom designed wrapper for inet_pton to allow <ip>%<iface> format
*
*
@@ -352,7 +354,7 @@ static int SLPIfaceGetV6Addr(SLPIfaceInfo * ifaceinfo)
if (getifaddrs(&ifaddrs))
return -1;
- for (ifa = ifaddrs; ifa && ifaceinfo->iface_count < SLP_MAX_IFACES; ifa = ifa->ifa_next)
+ for (ifa = ifaddrs; ifa && ifaceinfo->iface_count < slp_max_ifaces; ifa = ifa->ifa_next)
{
if(ifa->ifa_addr->sa_family != AF_INET6)
continue;
@@ -374,6 +376,11 @@ static int SLPIfaceGetV6Addr(SLPIfaceInfo * ifaceinfo)
++ifaceinfo->iface_count;
}
freeifaddrs(ifaddrs);
+ if (ifa)
+ {
+ errno = ENOBUFS;
+ return -1;
+ }
return 0;
}
@@ -429,14 +436,18 @@ int sizeof_ifreq(struct ifreq* ifr)
int SLPIfaceGetDefaultInfo(SLPIfaceInfo * ifaceinfo, int family)
{
sockfd_t fd;
- struct ifreq ifrlist[SLP_MAX_IFACES];
+ struct ifreq *ifrlist;
struct ifreq ifrflags;
struct ifreq * ifr;
struct sockaddr* sa;
char * p;
struct ifconf ifc;
- ifc.ifc_len = sizeof(struct ifreq) * SLP_MAX_IFACES;
+ ifrlist = malloc(sizeof(struct ifreq) * slp_max_ifaces);
+ if (ifrlist == NULL) {
+ return -1;
+ }
+ ifc.ifc_len = sizeof(struct ifreq) * slp_max_ifaces;
ifc.ifc_req = ifrlist;
if ((family == AF_INET6) || (family == AF_UNSPEC))
@@ -454,10 +465,11 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo * ifaceinfo, int family)
#endif
{
closesocket(fd);
+ xfree(ifrlist);
return -1;
}
- for (p = ifc.ifc_buf; p < ifc.ifc_buf + ifc.ifc_len && ifaceinfo->iface_count < SLP_MAX_IFACES;)
+ for (p = ifc.ifc_buf; p < ifc.ifc_buf + ifc.ifc_len && ifaceinfo->iface_count < slp_max_ifaces;)
{
ifr = (struct ifreq*) p;
sa = (struct sockaddr*)&(ifr->ifr_addr);
@@ -480,7 +492,7 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo * ifaceinfo, int family)
}
/* reset ifc_len for next get */
- ifc.ifc_len = sizeof(struct ifreq) * SLP_MAX_IFACES;
+ ifc.ifc_len = sizeof(struct ifreq) * slp_max_ifaces;
if ((family == AF_INET) || (family == AF_UNSPEC))
{
@@ -494,10 +506,11 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo * ifaceinfo, int family)
#endif
{
closesocket(fd);
+ xfree(ifrlist);
return -1;
}
- for (p = ifc.ifc_buf; p < ifc.ifc_buf + ifc.ifc_len && ifaceinfo->iface_count < SLP_MAX_IFACES;)
+ for (p = ifc.ifc_buf; p < ifc.ifc_buf + ifc.ifc_len && ifaceinfo->iface_count < slp_max_ifaces;)
{
ifr = (struct ifreq*) p;
sa = (struct sockaddr*)&(ifr->ifr_addr);
@@ -516,6 +529,7 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo * ifaceinfo, int family)
closesocket(fd);
}
}
+ xfree(ifrlist);
return 0;
}
@@ -572,7 +586,7 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo* ifaceinfo, int family)
return (errno = WSAGetLastError()), -1;
}
plist = (SOCKET_ADDRESS_LIST*)buffer;
- for (i = 0; i < plist->iAddressCount && ifaceinfo->iface_count < SLP_MAX_IFACES; ++i)
+ for (i = 0; i < plist->iAddressCount && ifaceinfo->iface_count < slp_max_ifaces; ++i)
if ((plist->Address[i].lpSockaddr->sa_family == AF_INET6) &&
(0 == GetV6Scope((struct sockaddr_in6*)plist->Address[i].lpSockaddr, NULL)) &&
/*Ignore Teredo and loopback pseudo-interfaces*/
@@ -609,7 +623,7 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo* ifaceinfo, int family)
return (errno = WSAGetLastError()), -1;
}
plist = (SOCKET_ADDRESS_LIST*)buffer;
- for (i = 0; i < plist->iAddressCount && ifaceinfo->iface_count < SLP_MAX_IFACES; ++i)
+ for (i = 0; i < plist->iAddressCount && ifaceinfo->iface_count < slp_max_ifaces; ++i)
if (plist->Address[i].lpSockaddr->sa_family == AF_INET)
memcpy(&ifaceinfo->iface_addr[ifaceinfo->iface_count++],
plist->Address[i].lpSockaddr, sizeof(struct sockaddr_in));
@@ -1078,6 +1092,21 @@ int main(int argc, char * argv[])
WSAStartup(MAKEWORD(2, 2), &wsadata);
#endif
+ ifaceinfo.iface_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
+ if (ifaceinfo.iface_addr == NULL)
+ {
+ fprintf(stderr, "iface_addr malloc(%d) failed\n",
+ slp_max_ifaces * sizeof(struct sockaddr_storage));
+ exit(1);
+ }
+ ifaceinfo.bcast_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
+ if (ifaceinfo.bcast_addr == NULL)
+ {
+ fprintf(stderr, "bcast_addr malloc(%d) failed\n",
+ slp_max_ifaces * sizeof(struct sockaddr_storage));
+ exit(1);
+ }
+
if (SLPIfaceGetInfo(0, &ifaceinfo, AF_INET) == 0)
for (i = 0; i < ifaceinfo.iface_count; i++)
{
@@ -1130,6 +1159,8 @@ int main(int argc, char * argv[])
printf("sock addr string v6 = %s\n", addrstr);
xfree(addrstr);
}
+ xfree(ifaceinfo.iface_addr);
+ xfree(ifaceinfo.bcast_addr);
#ifdef _WIN32
WSACleanup();
diff --git a/common/slp_iface.h b/common/slp_iface.h
index e9bfd5a..ce0d111 100644
--- a/common/slp_iface.h
+++ b/common/slp_iface.h
@@ -52,14 +52,15 @@
/** The maximum number of interfaces we can handle. */
#define SLP_MAX_IFACES 100
+extern int slp_max_ifaces;
/** Interface information structure */
typedef struct _SLPInterfaceInfo
{
int iface_count;
int bcast_count;
- struct sockaddr_storage iface_addr[SLP_MAX_IFACES];
- struct sockaddr_storage bcast_addr[SLP_MAX_IFACES];
+ struct sockaddr_storage *iface_addr;
+ struct sockaddr_storage *bcast_addr;
} SLPIfaceInfo;
int SLPIfaceGetInfo(char const * useifaces, SLPIfaceInfo * ifaceinfo,
diff --git a/common/slp_xcast.c b/common/slp_xcast.c
index b891769..3dca0dc 100644
--- a/common/slp_xcast.c
+++ b/common/slp_xcast.c
@@ -371,6 +371,47 @@ int main(void)
struct sockaddr_storage dst;
int mtu;
+ socks.sock = malloc(slp_max_ifaces*sizeof(sockfd_t));
+ if (socks.sock == NULL)
+ {
+ fprintf(stderr, "socks.sock malloc(%d) failed\n",
+ slp_max_ifaces*sizeof(sockfd_t));
+ exit(1);
+ }
+ socks.peeraddr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage));
+ if (socks.peeraddr == NULL)
+ {
+ fprintf(stderr, "socks.peeraddr malloc(%d) failed\n",
+ slp_max_ifaces*sizeof(struct sockaddr_storage));
+ exit(1);
+ }
+ ifaceinfo.iface_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
+ if (ifaceinfo.iface_addr == NULL)
+ {
+ fprintf(stderr, "ifaceinfo.iface_addr malloc(%d) failed\n",
+ slp_max_ifaces*sizeof(struct sockaddr_storage));
+ exit(1);
+ }
+ ifaceinfo.bcast_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
+ if (ifaceinfo.bcast_addr == NULL)
+ {
+ fprintf(stderr, "ifaceinfo.bcast_addr malloc(%d) failed\n",
+ slp_max_ifaces*sizeof(struct sockaddr_storage));
+ exit(1);
+ }
+ ifaceinfo6.iface_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
+ if (ifaceinfo.bcast_addr == NULL)
+ {
+ fprintf(stderr, "ifaceinfo6.iface_addr malloc(%d) failed\n",
+ slp_max_ifaces*sizeof(struct sockaddr_storage));
+ exit(1);
+ }
+ ifaceinfo6.bcast_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
+ if (ifaceinfo.bcast_addr == NULL) {
+ fprintf(stderr, "ifaceinfo6.bcast_addr malloc(%d) failed\n",
+ slp_max_ifaces*sizeof(struct sockaddr_storage));
+ exit(1);
+ }
#ifdef _WIN32
WSADATA wsadata;
WSAStartup(MAKEWORD(2, 2), &wsadata);
@@ -409,6 +450,12 @@ int main(void)
SLPBufferFree(buffer);
}
+ xfree(ifaceinfo.iface_addr);
+ xfree(ifaceinfo.bcast_addr);
+ xfree(ifaceinfo6.iface_addr);
+ xfree(ifaceinfo6.bcast_addr);
+ xfree(socks.sock);
+ xfree(socks.peeraddr);
#ifdef _WIN32
WSACleanup();
diff --git a/common/slp_xcast.h b/common/slp_xcast.h
index c671b2b..49e4682 100644
--- a/common/slp_xcast.h
+++ b/common/slp_xcast.h
@@ -57,10 +57,10 @@ typedef struct _SLPXcastSockets
int sock_count;
/** An array of sockets managed by this structure. */
- sockfd_t sock[SLP_MAX_IFACES];
+ sockfd_t *sock;
/** An array of addresses that matches each socket in the sock array. */
- struct sockaddr_storage peeraddr[SLP_MAX_IFACES];
+ struct sockaddr_storage *peeraddr;
} SLPXcastSockets;
diff --git a/etc/slp.conf b/etc/slp.conf
index be57e77..156b6d7 100644
--- a/etc/slp.conf
+++ b/etc/slp.conf
@@ -148,6 +148,11 @@
# A integer giving the network packet MTU in bytes. (Default is 1400)
;net.slp.MTU = 1400
+#
+# If operating as an SA or DA, this specifies the maximum number of interfaces
+# that can be active. (Default is 100)
+;net.slp.max_ifaces = 100
+
# If operating as an SA or DA, then any local addresses that are going to be
# used must be specified. Both IPv4 and IPv6 addresses may be specified.
# Only link-local addresses can be used for IPv6 SLP multicast. Any
diff --git a/libslp/libslp_network.c b/libslp/libslp_network.c
index 2530bfe..cd10255 100644
--- a/libslp/libslp_network.c
+++ b/libslp/libslp_network.c
@@ -828,6 +828,7 @@ SLPError NetworkMcastRqstRply(SLPHandleInfo * handle, void * buf,
SLPIfaceInfo v4outifaceinfo;
SLPIfaceInfo v6outifaceinfo;
SLPXcastSockets xcastsocks;
+ int alistsize;
int currIntf = 0;
int requestSent;
@@ -841,6 +842,16 @@ SLPError NetworkMcastRqstRply(SLPHandleInfo * handle, void * buf,
/* save off a few things we don't want to recalculate */
langtaglen = strlen(handle->langtag);
+ /* initialize pointers freed on error */
+ dstifaceinfo.iface_addr = NULL;
+ dstifaceinfo.bcast_addr = NULL;
+ v4outifaceinfo.iface_addr = NULL;
+ v4outifaceinfo.bcast_addr = NULL;
+ v6outifaceinfo.iface_addr = NULL;
+ v6outifaceinfo.bcast_addr = NULL;
+ xcastsocks.sock = NULL;
+ xcastsocks.peeraddr = NULL;
+
xid = SLPXidGenerate();
mtu = SLPPropertyGetMTU();
sendbuf = SLPBufferAlloc(mtu);
@@ -850,9 +861,60 @@ SLPError NetworkMcastRqstRply(SLPHandleInfo * handle, void * buf,
goto FINISHED;
}
+ alistsize = slp_max_ifaces * sizeof(struct sockaddr_storage);
+
+ dstifaceinfo.iface_count = 0;
+ dstifaceinfo.iface_addr = malloc(alistsize);
+ if (dstifaceinfo.iface_addr == NULL)
+ {
+ result = SLP_MEMORY_ALLOC_FAILED;
+ goto FINISHED;
+ }
+ dstifaceinfo.bcast_addr = malloc(alistsize);
+ if (dstifaceinfo.bcast_addr == NULL)
+ {
+ result = SLP_MEMORY_ALLOC_FAILED;
+ goto FINISHED;
+ }
v4outifaceinfo.iface_count = 0;
+ v4outifaceinfo.iface_addr = malloc(alistsize);
+ if (v4outifaceinfo.iface_addr == NULL)
+ {
+ result = SLP_MEMORY_ALLOC_FAILED;
+ goto FINISHED;
+ }
+ v4outifaceinfo.bcast_addr = malloc(alistsize);
+ if (v4outifaceinfo.bcast_addr == NULL)
+ {
+ result = SLP_MEMORY_ALLOC_FAILED;
+ goto FINISHED;
+ }
v6outifaceinfo.iface_count = 0;
+ v6outifaceinfo.iface_addr = malloc(alistsize);
+ if (v6outifaceinfo.iface_addr == NULL)
+ {
+ result = SLP_MEMORY_ALLOC_FAILED;
+ goto FINISHED;
+ }
+ v6outifaceinfo.bcast_addr = malloc(alistsize);
+ if (v6outifaceinfo.bcast_addr == NULL)
+ {
+ result = SLP_MEMORY_ALLOC_FAILED;
+ goto FINISHED;
+ }
xcastsocks.sock_count = 0;
+ xcastsocks.sock = malloc(slp_max_ifaces * sizeof(sockfd_t));
+ if (xcastsocks.sock == NULL)
+ {
+ result = SLP_MEMORY_ALLOC_FAILED;
+ goto FINISHED;
+ }
+ xcastsocks.peeraddr = malloc(alistsize);
+ if (xcastsocks.peeraddr == NULL)
+ {
+ result = SLP_MEMORY_ALLOC_FAILED;
+ goto FINISHED;
+ }
#if !defined(MI_NOT_SUPPORTED)
/* Determine which multicast addresses to send to. */
@@ -1168,6 +1230,14 @@ CLEANUP:
SLPBufferFree(sendbuf);
SLPBufferFree(recvbuf);
SLPXcastSocketsClose(&xcastsocks);
+ xfree(xcastsocks.sock);
+ xfree(xcastsocks.peeraddr);
+ xfree(dstifaceinfo.iface_addr);
+ xfree(dstifaceinfo.bcast_addr);
+ xfree(v4outifaceinfo.iface_addr);
+ xfree(v4outifaceinfo.bcast_addr);
+ xfree(v6outifaceinfo.iface_addr);
+ xfree(v6outifaceinfo.bcast_addr);
return result;
}
diff --git a/slpd/slpd_incoming.c b/slpd/slpd_incoming.c
index 0371455..e427d22 100644
--- a/slpd/slpd_incoming.c
+++ b/slpd/slpd_incoming.c
@@ -752,9 +752,26 @@ int SLPDIncomingInit(void)
/* string in a safety way */
/*---------------------------------------------------------------------*/
+ ifaces.iface_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage));
+ if (ifaces.iface_addr == NULL)
+ {
+ SLPDLog("can't allocate %d iface_addrs\n", slp_max_ifaces);
+ exit(1);
+ }
+ ifaces.bcast_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage));
+ if (ifaces.bcast_addr == NULL)
+ {
+ SLPDLog("can't allocate %d bcast_addrs\n", slp_max_ifaces);
+ exit(1);
+ }
+ ifaces.bcast_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage));
if (G_SlpdProperty.interfaces != NULL)
- SLPIfaceGetInfo(G_SlpdProperty.interfaces, &ifaces, AF_UNSPEC);
- else
+ {
+ if (SLPIfaceGetInfo(G_SlpdProperty.interfaces, &ifaces, AF_UNSPEC) < 0) {
+ SLPDLog("SLPIfaceGetInfo failed: %s\n", strerror(errno));
+ exit(1);
+ }
+ } else
ifaces.iface_count = 0;
for (i = 0; i < ifaces.iface_count; i++)
diff --git a/slpd/slpd_property.c b/slpd/slpd_property.c
index 81b6a8e..f9c64bb 100644
--- a/slpd/slpd_property.c
+++ b/slpd/slpd_property.c
@@ -66,6 +66,8 @@ void SLPDPropertyReinit(void)
xfree(G_SlpdProperty.DAAddresses);
xfree(G_SlpdProperty.interfaces);
xfree(G_SlpdProperty.locale);
+ xfree(G_SlpdProperty.ifaceInfo.iface_addr);
+ xfree(G_SlpdProperty.ifaceInfo.bcast_addr);
/* reinitialize property sub-system */
(void)SLPPropertyReinit();
@@ -149,7 +151,22 @@ void SLPDPropertyReinit(void)
else if (SLPNetIsIPV6())
family = AF_INET6;
+ slp_max_ifaces = SLPPropertyAsInteger("net.slp.max_ifaces");
+ if (slp_max_ifaces <= 0)
+ slp_max_ifaces = SLP_MAX_IFACES;
myinterfaces = SLPPropertyXDup("net.slp.interfaces");
+ G_SlpdProperty.ifaceInfo.iface_addr = malloc(slp_max_ifaces *
+ sizeof(struct sockaddr_storage));
+ if (G_SlpdProperty.ifaceInfo.iface_addr == NULL)
+ {
+ SLPDLog("Cannot allocate iface_addr for %d addresses\n", slp_max_ifaces);
+ }
+ G_SlpdProperty.ifaceInfo.bcast_addr = malloc(slp_max_ifaces *
+ sizeof(struct sockaddr_storage));
+ if (G_SlpdProperty.ifaceInfo.bcast_addr == NULL)
+ {
+ SLPDLog("Cannot allocate bcast_addr for %d addresses\n", slp_max_ifaces);
+ }
sts = SLPIfaceGetInfo(myinterfaces, &G_SlpdProperty.ifaceInfo, family);
xfree(myinterfaces);
@@ -246,6 +263,8 @@ void SLPDPropertyDeinit(void)
xfree(G_SlpdProperty.indexedAttributes);
#endif
xfree(G_SlpdProperty.locale);
+ xfree(G_SlpdProperty.ifaceInfo.iface_addr);
+ xfree(G_SlpdProperty.ifaceInfo.bcast_addr);
SLPPropertyExit();
}
|
|
From: Nick W. <ne...@wi...> - 2012-08-24 16:22:25
|
I've never run any automated tests. For me, basic functionality with and without directory agents is enough, making sure you can get component attributes, a couple of sanity sniffs of the network, etc. --Nick |
|
From: David S. <dls...@us...> - 2012-07-13 14:46:05
|
I haven't seen any traffic on this. Comments?
+-DLS
|
|
From: Roel v. de K. <rk...@dd...> - 2012-07-10 15:31:29
|
Hi all, I ran into this mail below, which I think we shouldn't simply ignore. Sorry Vitezslav, for doing so for almost a year :-[ After a little svn digging, I found out that the problem in common/slp_predicate.c seems to have been introduced in a code clean-up by John: http://openslp.svn.sourceforge.net/viewvc/openslp/trunk/openslp/common/slp_predicate.c?r1=1494&r2=1493&pathrev=1494#l307 The problem in slpd/slpd_predicate.c seems to have been there since the introduction of the filterv1() function by Matthew: http://openslp.svn.sourceforge.net/viewvc/openslp/trunk/openslp/slpd/slpd_predicate.c?r1=1144&r2=1143&pathrev=1144#l1145 I haven't looked into what the code actually does, so I didn't fix these issues yet ;-) Anyone feeling like doing so? BR, Roel On 08/24/2011 02:41 PM, Vitezslav Crhonek wrote: > Hello, > > We found possible defects in source code during Coverity scan (static > analysis) of openslp-2.0.beta2. I'd like to discuss two of them. > > common/slp_predicate.c: > 301 case opaque: > 302 if (!memcmp((((char *) (a->val.opaqueVal)) + 4), > 303 (((char *)(b->val.opaqueVal)) + 4), > 304 SLP_MIN((*((int *)a->val.opaqueVal)), > 305 (*((int *)a->val.opaqueVal))))) > 306 ; > 307 return 1; > > The "if" statement is followed by an extra semicolon, which results in > "return 1" being called unconditionally. "memcmp" seems to be useless. > > slpd/slpd_predicate.c: > 1081 Operation op; > ... > 1110 op = EQUAL; > ... > 1132 /**** Do operation. *****/ > 1133 if (op == PRESENT) > 1134 { > 1135 /*** Since the PRESENT operation is the same for all > types, > 1136 do that now. ***/ > 1137 return FR_EVAL_TRUE; > 1138 } > 1139 else > > Code between lines 1134 and 1138 will never be executed, because "op" > variable is set to EQUAL (!= PRESENT). No pointer is set to "op" - > I see no way how to change the value between assignation and condition. > Is it intentional? > > Please let me know what do you think. I believe it should be fixed. > And if you are interested in whole Coverity log, I can send it to you on > demand. > > Best regards, > Vitezslav Crhonek > > ------------------------------------------------------------------------------ > EMC VNX: the world's simplest storage, starting under $10K > The only unified storage solution that offers unified management > Up to 160% more powerful than alternatives and 25% more efficient. > Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev > _______________________________________________ > Openslp-devel mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openslp-devel |
|
From: John C. <joh...@gm...> - 2012-07-09 16:08:26
|
Nick, I'm all for it. As you know, I haven't had a lot of time for OpenSLP lately. I'm sorry - I'm not much of a project leader here. But my heart has been in the right place. :) Please do what you like - all you guys have been doing so well with it, I've just sort of stuck my nose in once in a while when I thought I could help. If anyone needs help understanding sourceforge or process issues, just ping me. I'll be happy to help out on specific issues. John From: Nick Wagner [mailto:ne...@wi...] Sent: Monday, July 09, 2012 8:41 AM To: ope...@li... Subject: [Openslp-devel] Any chance of moving the "beta" to stable soon? Every once in a while, I'm still asked questions on 1.2.1, since that is the "stable" branch. We've done so much since then -- does everyone agree that we could move our beta to stable? --Nick |
|
From: Hird M. <Mat...@uk...> - 2012-07-09 15:31:02
|
Yes, very much so! _____ From: Nick Wagner [mailto:ne...@wi...] Sent: 09 July 2012 15:41 To: ope...@li... Subject: [Openslp-devel] Any chance of moving the "beta" to stable soon? Every once in a while, I'm still asked questions on 1.2.1, since that is the "stable" branch. We've done so much since then -- does everyone agree that we could move our beta to stable? --Nick |
|
From: Roel v. de K. <rk...@dd...> - 2012-07-09 14:46:44
|
On 07/09/2012 04:40 PM, Nick Wagner wrote:
> Every once in a while, I'm still asked questions on 1.2.1, since that
> is the "stable" branch. We've done so much since then -- does
> everyone agree that we could move our beta to stable?
Fine with me! But who's gonna handle all the questions about the new
'stable' then? ;-)
Roel
>
>
> --Nick
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
>
> _______________________________________________
> Openslp-devel mailing list
> Ope...@li...
> https://lists.sourceforge.net/lists/listinfo/openslp-devel
|
|
From: Nick W. <ne...@wi...> - 2012-07-09 14:40:48
|
Every once in a while, I'm still asked questions on 1.2.1, since that is the "stable" branch. We've done so much since then -- does everyone agree that we could move our beta to stable? --Nick |
|
From: David L S. <dls...@us...> - 2012-06-27 12:04:50
|
We have customers who have a need to use SLP on systems that have more than
current maximum number of interfaces (MAX_SLP_IFACES) of 100.
The following patch converts the compile-time maximum to be a run-time
configurable value to allow an administrator to increase it on systems with
large numbers of interfaces.
+-DLS
Signed-off-by: David L Stevens <dls...@us...>
diff --git a/common/slp_iface.c b/common/slp_iface.c
index 2563f8f..59bb72a 100644
--- a/common/slp_iface.c
+++ b/common/slp_iface.c
@@ -55,6 +55,8 @@
/** The max interface name lenght is 20 */
#define MAX_IFACE_LEN 20
+int slp_max_ifaces = SLP_MAX_IFACES;
+
/** Custom designed wrapper for inet_pton to allow <ip>%<iface> format
*
*
@@ -352,7 +354,7 @@ static int SLPIfaceGetV6Addr(SLPIfaceInfo * ifaceinfo)
if (getifaddrs(&ifaddrs))
return -1;
- for (ifa = ifaddrs; ifa && ifaceinfo->iface_count < SLP_MAX_IFACES; ifa = ifa->ifa_next)
+ for (ifa = ifaddrs; ifa && ifaceinfo->iface_count < slp_max_ifaces; ifa = ifa->ifa_next)
{
if(ifa->ifa_addr->sa_family != AF_INET6)
continue;
@@ -374,6 +376,11 @@ static int SLPIfaceGetV6Addr(SLPIfaceInfo * ifaceinfo)
++ifaceinfo->iface_count;
}
freeifaddrs(ifaddrs);
+ if (ifa)
+ {
+ errno = ENOBUFS;
+ return -1;
+ }
return 0;
}
@@ -429,14 +436,18 @@ int sizeof_ifreq(struct ifreq* ifr)
int SLPIfaceGetDefaultInfo(SLPIfaceInfo * ifaceinfo, int family)
{
sockfd_t fd;
- struct ifreq ifrlist[SLP_MAX_IFACES];
+ struct ifreq *ifrlist;
struct ifreq ifrflags;
struct ifreq * ifr;
struct sockaddr* sa;
char * p;
struct ifconf ifc;
- ifc.ifc_len = sizeof(struct ifreq) * SLP_MAX_IFACES;
+ ifrlist = malloc(sizeof(struct ifreq) * slp_max_ifaces);
+ if (ifrlist == NULL) {
+ return -1;
+ }
+ ifc.ifc_len = sizeof(struct ifreq) * slp_max_ifaces;
ifc.ifc_req = ifrlist;
if ((family == AF_INET6) || (family == AF_UNSPEC))
@@ -454,10 +465,11 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo * ifaceinfo, int family)
#endif
{
closesocket(fd);
+ xfree(ifrlist);
return -1;
}
- for (p = ifc.ifc_buf; p < ifc.ifc_buf + ifc.ifc_len && ifaceinfo->iface_count < SLP_MAX_IFACES;)
+ for (p = ifc.ifc_buf; p < ifc.ifc_buf + ifc.ifc_len && ifaceinfo->iface_count < slp_max_ifaces;)
{
ifr = (struct ifreq*) p;
sa = (struct sockaddr*)&(ifr->ifr_addr);
@@ -480,7 +492,7 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo * ifaceinfo, int family)
}
/* reset ifc_len for next get */
- ifc.ifc_len = sizeof(struct ifreq) * SLP_MAX_IFACES;
+ ifc.ifc_len = sizeof(struct ifreq) * slp_max_ifaces;
if ((family == AF_INET) || (family == AF_UNSPEC))
{
@@ -494,10 +506,11 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo * ifaceinfo, int family)
#endif
{
closesocket(fd);
+ xfree(ifrlist);
return -1;
}
- for (p = ifc.ifc_buf; p < ifc.ifc_buf + ifc.ifc_len && ifaceinfo->iface_count < SLP_MAX_IFACES;)
+ for (p = ifc.ifc_buf; p < ifc.ifc_buf + ifc.ifc_len && ifaceinfo->iface_count < slp_max_ifaces;)
{
ifr = (struct ifreq*) p;
sa = (struct sockaddr*)&(ifr->ifr_addr);
@@ -516,6 +529,7 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo * ifaceinfo, int family)
closesocket(fd);
}
}
+ xfree(ifrlist);
return 0;
}
@@ -572,7 +586,7 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo* ifaceinfo, int family)
return (errno = WSAGetLastError()), -1;
}
plist = (SOCKET_ADDRESS_LIST*)buffer;
- for (i = 0; i < plist->iAddressCount && ifaceinfo->iface_count < SLP_MAX_IFACES; ++i)
+ for (i = 0; i < plist->iAddressCount && ifaceinfo->iface_count < slp_max_ifaces; ++i)
if ((plist->Address[i].lpSockaddr->sa_family == AF_INET6) &&
(0 == GetV6Scope((struct sockaddr_in6*)plist->Address[i].lpSockaddr, NULL)) &&
/*Ignore Teredo and loopback pseudo-interfaces*/
@@ -609,7 +623,7 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo* ifaceinfo, int family)
return (errno = WSAGetLastError()), -1;
}
plist = (SOCKET_ADDRESS_LIST*)buffer;
- for (i = 0; i < plist->iAddressCount && ifaceinfo->iface_count < SLP_MAX_IFACES; ++i)
+ for (i = 0; i < plist->iAddressCount && ifaceinfo->iface_count < slp_max_ifaces; ++i)
if (plist->Address[i].lpSockaddr->sa_family == AF_INET)
memcpy(&ifaceinfo->iface_addr[ifaceinfo->iface_count++],
plist->Address[i].lpSockaddr, sizeof(struct sockaddr_in));
@@ -1078,6 +1092,21 @@ int main(int argc, char * argv[])
WSAStartup(MAKEWORD(2, 2), &wsadata);
#endif
+ ifaceinfo.iface_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
+ if (ifaceinfo.iface_addr == NULL)
+ {
+ fprintf(stderr, "iface_addr malloc(%d) failed\n",
+ slp_max_ifaces * sizeof(struct sockaddr_storage));
+ exit(1);
+ }
+ ifaceinfo.bcast_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
+ if (ifaceinfo.bcast_addr == NULL)
+ {
+ fprintf(stderr, "bcast_addr malloc(%d) failed\n",
+ slp_max_ifaces * sizeof(struct sockaddr_storage));
+ exit(1);
+ }
+
if (SLPIfaceGetInfo(0, &ifaceinfo, AF_INET) == 0)
for (i = 0; i < ifaceinfo.iface_count; i++)
{
@@ -1130,6 +1159,8 @@ int main(int argc, char * argv[])
printf("sock addr string v6 = %s\n", addrstr);
xfree(addrstr);
}
+ xfree(ifaceinfo.iface_addr);
+ xfree(ifaceinfo.bcast_addr);
#ifdef _WIN32
WSACleanup();
diff --git a/common/slp_iface.h b/common/slp_iface.h
index e9bfd5a..ce0d111 100644
--- a/common/slp_iface.h
+++ b/common/slp_iface.h
@@ -52,14 +52,15 @@
/** The maximum number of interfaces we can handle. */
#define SLP_MAX_IFACES 100
+extern int slp_max_ifaces;
/** Interface information structure */
typedef struct _SLPInterfaceInfo
{
int iface_count;
int bcast_count;
- struct sockaddr_storage iface_addr[SLP_MAX_IFACES];
- struct sockaddr_storage bcast_addr[SLP_MAX_IFACES];
+ struct sockaddr_storage *iface_addr;
+ struct sockaddr_storage *bcast_addr;
} SLPIfaceInfo;
int SLPIfaceGetInfo(char const * useifaces, SLPIfaceInfo * ifaceinfo,
diff --git a/common/slp_xcast.c b/common/slp_xcast.c
index b891769..3dca0dc 100644
--- a/common/slp_xcast.c
+++ b/common/slp_xcast.c
@@ -371,6 +371,47 @@ int main(void)
struct sockaddr_storage dst;
int mtu;
+ socks.sock = malloc(slp_max_ifaces*sizeof(sockfd_t));
+ if (socks.sock == NULL)
+ {
+ fprintf(stderr, "socks.sock malloc(%d) failed\n",
+ slp_max_ifaces*sizeof(sockfd_t));
+ exit(1);
+ }
+ socks.peeraddr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage));
+ if (socks.peeraddr == NULL)
+ {
+ fprintf(stderr, "socks.peeraddr malloc(%d) failed\n",
+ slp_max_ifaces*sizeof(struct sockaddr_storage));
+ exit(1);
+ }
+ ifaceinfo.iface_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
+ if (ifaceinfo.iface_addr == NULL)
+ {
+ fprintf(stderr, "ifaceinfo.iface_addr malloc(%d) failed\n",
+ slp_max_ifaces*sizeof(struct sockaddr_storage));
+ exit(1);
+ }
+ ifaceinfo.bcast_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
+ if (ifaceinfo.bcast_addr == NULL)
+ {
+ fprintf(stderr, "ifaceinfo.bcast_addr malloc(%d) failed\n",
+ slp_max_ifaces*sizeof(struct sockaddr_storage));
+ exit(1);
+ }
+ ifaceinfo6.iface_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
+ if (ifaceinfo.bcast_addr == NULL)
+ {
+ fprintf(stderr, "ifaceinfo6.iface_addr malloc(%d) failed\n",
+ slp_max_ifaces*sizeof(struct sockaddr_storage));
+ exit(1);
+ }
+ ifaceinfo6.bcast_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage);
+ if (ifaceinfo.bcast_addr == NULL) {
+ fprintf(stderr, "ifaceinfo6.bcast_addr malloc(%d) failed\n",
+ slp_max_ifaces*sizeof(struct sockaddr_storage));
+ exit(1);
+ }
#ifdef _WIN32
WSADATA wsadata;
WSAStartup(MAKEWORD(2, 2), &wsadata);
@@ -409,6 +450,12 @@ int main(void)
SLPBufferFree(buffer);
}
+ xfree(ifaceinfo.iface_addr);
+ xfree(ifaceinfo.bcast_addr);
+ xfree(ifaceinfo6.iface_addr);
+ xfree(ifaceinfo6.bcast_addr);
+ xfree(socks.sock);
+ xfree(socks.peeraddr);
#ifdef _WIN32
WSACleanup();
diff --git a/common/slp_xcast.h b/common/slp_xcast.h
index c671b2b..49e4682 100644
--- a/common/slp_xcast.h
+++ b/common/slp_xcast.h
@@ -57,10 +57,10 @@ typedef struct _SLPXcastSockets
int sock_count;
/** An array of sockets managed by this structure. */
- sockfd_t sock[SLP_MAX_IFACES];
+ sockfd_t *sock;
/** An array of addresses that matches each socket in the sock array. */
- struct sockaddr_storage peeraddr[SLP_MAX_IFACES];
+ struct sockaddr_storage *peeraddr;
} SLPXcastSockets;
diff --git a/etc/slp.conf b/etc/slp.conf
index be57e77..156b6d7 100644
--- a/etc/slp.conf
+++ b/etc/slp.conf
@@ -148,6 +148,11 @@
# A integer giving the network packet MTU in bytes. (Default is 1400)
;net.slp.MTU = 1400
+#
+# If operating as an SA or DA, this specifies the maximum number of interfaces
+# that can be active. (Default is 100)
+;net.slp.max_ifaces = 100
+
# If operating as an SA or DA, then any local addresses that are going to be
# used must be specified. Both IPv4 and IPv6 addresses may be specified.
# Only link-local addresses can be used for IPv6 SLP multicast. Any
diff --git a/libslp/libslp_network.c b/libslp/libslp_network.c
index 2530bfe..cd10255 100644
--- a/libslp/libslp_network.c
+++ b/libslp/libslp_network.c
@@ -828,6 +828,7 @@ SLPError NetworkMcastRqstRply(SLPHandleInfo * handle, void * buf,
SLPIfaceInfo v4outifaceinfo;
SLPIfaceInfo v6outifaceinfo;
SLPXcastSockets xcastsocks;
+ int alistsize;
int currIntf = 0;
int requestSent;
@@ -841,6 +842,16 @@ SLPError NetworkMcastRqstRply(SLPHandleInfo * handle, void * buf,
/* save off a few things we don't want to recalculate */
langtaglen = strlen(handle->langtag);
+ /* initialize pointers freed on error */
+ dstifaceinfo.iface_addr = NULL;
+ dstifaceinfo.bcast_addr = NULL;
+ v4outifaceinfo.iface_addr = NULL;
+ v4outifaceinfo.bcast_addr = NULL;
+ v6outifaceinfo.iface_addr = NULL;
+ v6outifaceinfo.bcast_addr = NULL;
+ xcastsocks.sock = NULL;
+ xcastsocks.peeraddr = NULL;
+
xid = SLPXidGenerate();
mtu = SLPPropertyGetMTU();
sendbuf = SLPBufferAlloc(mtu);
@@ -850,9 +861,60 @@ SLPError NetworkMcastRqstRply(SLPHandleInfo * handle, void * buf,
goto FINISHED;
}
+ alistsize = slp_max_ifaces * sizeof(struct sockaddr_storage);
+
+ dstifaceinfo.iface_count = 0;
+ dstifaceinfo.iface_addr = malloc(alistsize);
+ if (dstifaceinfo.iface_addr == NULL)
+ {
+ result = SLP_MEMORY_ALLOC_FAILED;
+ goto FINISHED;
+ }
+ dstifaceinfo.bcast_addr = malloc(alistsize);
+ if (dstifaceinfo.bcast_addr == NULL)
+ {
+ result = SLP_MEMORY_ALLOC_FAILED;
+ goto FINISHED;
+ }
v4outifaceinfo.iface_count = 0;
+ v4outifaceinfo.iface_addr = malloc(alistsize);
+ if (v4outifaceinfo.iface_addr == NULL)
+ {
+ result = SLP_MEMORY_ALLOC_FAILED;
+ goto FINISHED;
+ }
+ v4outifaceinfo.bcast_addr = malloc(alistsize);
+ if (v4outifaceinfo.bcast_addr == NULL)
+ {
+ result = SLP_MEMORY_ALLOC_FAILED;
+ goto FINISHED;
+ }
v6outifaceinfo.iface_count = 0;
+ v6outifaceinfo.iface_addr = malloc(alistsize);
+ if (v6outifaceinfo.iface_addr == NULL)
+ {
+ result = SLP_MEMORY_ALLOC_FAILED;
+ goto FINISHED;
+ }
+ v6outifaceinfo.bcast_addr = malloc(alistsize);
+ if (v6outifaceinfo.bcast_addr == NULL)
+ {
+ result = SLP_MEMORY_ALLOC_FAILED;
+ goto FINISHED;
+ }
xcastsocks.sock_count = 0;
+ xcastsocks.sock = malloc(slp_max_ifaces * sizeof(sockfd_t));
+ if (xcastsocks.sock == NULL)
+ {
+ result = SLP_MEMORY_ALLOC_FAILED;
+ goto FINISHED;
+ }
+ xcastsocks.peeraddr = malloc(alistsize);
+ if (xcastsocks.peeraddr == NULL)
+ {
+ result = SLP_MEMORY_ALLOC_FAILED;
+ goto FINISHED;
+ }
#if !defined(MI_NOT_SUPPORTED)
/* Determine which multicast addresses to send to. */
@@ -1168,6 +1230,14 @@ CLEANUP:
SLPBufferFree(sendbuf);
SLPBufferFree(recvbuf);
SLPXcastSocketsClose(&xcastsocks);
+ xfree(xcastsocks.sock);
+ xfree(xcastsocks.peeraddr);
+ xfree(dstifaceinfo.iface_addr);
+ xfree(dstifaceinfo.bcast_addr);
+ xfree(v4outifaceinfo.iface_addr);
+ xfree(v4outifaceinfo.bcast_addr);
+ xfree(v6outifaceinfo.iface_addr);
+ xfree(v6outifaceinfo.bcast_addr);
return result;
}
diff --git a/slpd/slpd_incoming.c b/slpd/slpd_incoming.c
index 0371455..e427d22 100644
--- a/slpd/slpd_incoming.c
+++ b/slpd/slpd_incoming.c
@@ -752,9 +752,26 @@ int SLPDIncomingInit(void)
/* string in a safety way */
/*---------------------------------------------------------------------*/
+ ifaces.iface_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage));
+ if (ifaces.iface_addr == NULL)
+ {
+ SLPDLog("can't allocate %d iface_addrs\n", slp_max_ifaces);
+ exit(1);
+ }
+ ifaces.bcast_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage));
+ if (ifaces.bcast_addr == NULL)
+ {
+ SLPDLog("can't allocate %d bcast_addrs\n", slp_max_ifaces);
+ exit(1);
+ }
+ ifaces.bcast_addr = malloc(slp_max_ifaces*sizeof(struct sockaddr_storage));
if (G_SlpdProperty.interfaces != NULL)
- SLPIfaceGetInfo(G_SlpdProperty.interfaces, &ifaces, AF_UNSPEC);
- else
+ {
+ if (SLPIfaceGetInfo(G_SlpdProperty.interfaces, &ifaces, AF_UNSPEC) < 0) {
+ SLPDLog("SLPIfaceGetInfo failed: %s\n", strerror(errno));
+ exit(1);
+ }
+ } else
ifaces.iface_count = 0;
for (i = 0; i < ifaces.iface_count; i++)
diff --git a/slpd/slpd_property.c b/slpd/slpd_property.c
index 81b6a8e..f9c64bb 100644
--- a/slpd/slpd_property.c
+++ b/slpd/slpd_property.c
@@ -66,6 +66,8 @@ void SLPDPropertyReinit(void)
xfree(G_SlpdProperty.DAAddresses);
xfree(G_SlpdProperty.interfaces);
xfree(G_SlpdProperty.locale);
+ xfree(G_SlpdProperty.ifaceInfo.iface_addr);
+ xfree(G_SlpdProperty.ifaceInfo.bcast_addr);
/* reinitialize property sub-system */
(void)SLPPropertyReinit();
@@ -149,7 +151,22 @@ void SLPDPropertyReinit(void)
else if (SLPNetIsIPV6())
family = AF_INET6;
+ slp_max_ifaces = SLPPropertyAsInteger("net.slp.max_ifaces");
+ if (slp_max_ifaces <= 0)
+ slp_max_ifaces = SLP_MAX_IFACES;
myinterfaces = SLPPropertyXDup("net.slp.interfaces");
+ G_SlpdProperty.ifaceInfo.iface_addr = malloc(slp_max_ifaces *
+ sizeof(struct sockaddr_storage));
+ if (G_SlpdProperty.ifaceInfo.iface_addr == NULL)
+ {
+ SLPDLog("Cannot allocate iface_addr for %d addresses\n", slp_max_ifaces);
+ }
+ G_SlpdProperty.ifaceInfo.bcast_addr = malloc(slp_max_ifaces *
+ sizeof(struct sockaddr_storage));
+ if (G_SlpdProperty.ifaceInfo.bcast_addr == NULL)
+ {
+ SLPDLog("Cannot allocate bcast_addr for %d addresses\n", slp_max_ifaces);
+ }
sts = SLPIfaceGetInfo(myinterfaces, &G_SlpdProperty.ifaceInfo, family);
xfree(myinterfaces);
@@ -246,6 +263,8 @@ void SLPDPropertyDeinit(void)
xfree(G_SlpdProperty.indexedAttributes);
#endif
xfree(G_SlpdProperty.locale);
+ xfree(G_SlpdProperty.ifaceInfo.iface_addr);
+ xfree(G_SlpdProperty.ifaceInfo.bcast_addr);
SLPPropertyExit();
}
|
|
From: Dan S. <dds...@ie...> - 2012-02-27 14:08:35
|
Thanks! Do you want me to close the bug or will you do that later? On Mon, Feb 27, 2012 at 8:50 AM, Roel van de Kraats <rk...@dd...> wrote: > > > On 02/22/2012 10:41 PM, Dan Streetman wrote: >> >> Hi all, >> >> seems like there are no objections to this patch, can a developer commit >> it? > > Done. See rev 1690. > > BR, > Roel >> >> >> Thanks! >> >> On Mon, Jan 30, 2012 at 12:33 PM, Dan Streetman<dds...@ie...> wrote: >>> >>> I opened a feature request to fix a namespace conflict, for the >>> function 'memdup' which is used in both openslp and net-snmp: >>> >>> https://sourceforge.net/tracker/?func=detail&aid=3481708&group_id=1730&atid=351730 >>> >>> This seems to be a easy change to openslp, anyone see any problems >>> with adding it? >> >> >> ------------------------------------------------------------------------------ >> Virtualization& Cloud Management Using Capacity Planning >> Cloud computing makes use of virtualization - but cloud computing >> also focuses on allowing computing to be delivered as a service. >> http://www.accelacomm.com/jaw/sfnl/114/51521223/ >> >> _______________________________________________ >> Openslp-devel mailing list >> Ope...@li... >> https://lists.sourceforge.net/lists/listinfo/openslp-devel > > |
|
From: Roel v. de K. <rk...@dd...> - 2012-02-27 13:50:48
|
On 02/22/2012 10:41 PM, Dan Streetman wrote:
> Hi all,
>
> seems like there are no objections to this patch, can a developer commit it?
Done. See rev 1690.
BR,
Roel
>
> Thanks!
>
> On Mon, Jan 30, 2012 at 12:33 PM, Dan Streetman<dds...@ie...> wrote:
>> I opened a feature request to fix a namespace conflict, for the
>> function 'memdup' which is used in both openslp and net-snmp:
>> https://sourceforge.net/tracker/?func=detail&aid=3481708&group_id=1730&atid=351730
>>
>> This seems to be a easy change to openslp, anyone see any problems
>> with adding it?
> ------------------------------------------------------------------------------
> Virtualization& Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Openslp-devel mailing list
> Ope...@li...
> https://lists.sourceforge.net/lists/listinfo/openslp-devel
|
|
From: Dan S. <dds...@ie...> - 2012-02-22 21:41:33
|
Hi all, seems like there are no objections to this patch, can a developer commit it? Thanks! On Mon, Jan 30, 2012 at 12:33 PM, Dan Streetman <dds...@ie...> wrote: > I opened a feature request to fix a namespace conflict, for the > function 'memdup' which is used in both openslp and net-snmp: > https://sourceforge.net/tracker/?func=detail&aid=3481708&group_id=1730&atid=351730 > > This seems to be a easy change to openslp, anyone see any problems > with adding it? |
|
From: Nick W. <ne...@wi...> - 2012-01-30 18:27:11
|
No objections here. On Mon, Jan 30, 2012 at 11:33 AM, Dan Streetman <dds...@ie...> wrote: > I opened a feature request to fix a namespace conflict, for the > function 'memdup' which is used in both openslp and net-snmp: > > https://sourceforge.net/tracker/?func=detail&aid=3481708&group_id=1730&atid=351730 > > This seems to be a easy change to openslp, anyone see any problems > with adding it? > > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > Openslp-devel mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openslp-devel > |
|
From: Dan S. <dds...@ie...> - 2012-01-30 17:33:45
|
I opened a feature request to fix a namespace conflict, for the function 'memdup' which is used in both openslp and net-snmp: https://sourceforge.net/tracker/?func=detail&aid=3481708&group_id=1730&atid=351730 This seems to be a easy change to openslp, anyone see any problems with adding it? |
|
From: Michal S. <ms...@su...> - 2012-01-24 13:47:44
|
I can't see your test program, Ian, (I wasn't subscribed to the mailing list in the time you sent the email unfortunatelly) but in my test program the "service:device-drivers:ftp://x3.bean.org/drivers/diskdrivers.drv" "service:device-drivers:http://www.bean.org/drivers/drivpak.drv" "service:weather.nasa:wtp://weather.nasa.com:12000" "service:weather.nasa:swtp://weather.nasa.com:12001" "service:chat.superchat://chat.superchat.com" addresses are correctly accepted. The "service:x.:/x" address is correctly rejected. As I understand the http://tools.ietf.org/html/rfc2609#section-2.1, these addresses are IMHO invalid: "service:x-private.name.authority:protocol://address:8888" "service:x-my-fancy-service.norton.ian:http://this.is.my.server" I don't see how could more than one '.' characters get between the first and second ':' character. (As there is a ':' character between "service:" and "://", the first variant in <service-type> had to be used which is: <abstract-type> ":" <url-scheme> that is: <type-name> [ "." <naming-auth> ] ":" <url-scheme> that is: <resname> [ "." <resname> ] ":" <resname> ) However if the multiple dots in <abstract-type> are commonly used, I'll update my patch to allow them. Attaching my test program. Thank you, Michal Srb > -----Original Message----- > From: Ian Norton [mailto:inorton@...] > Sent: Monday, December 19, 2011 1:30 AM > To: John Calcote > Subject: Re: [Openslp-devel] proposed patch for OpenSLP > > Running this up in the attached test program I've not been able to find any > addresses that are accepted. > > According to the RFC, here are some valid addresses. > > service:device-drivers:ftp://x3.bean.org/drivers/diskdrivers.drv > service:device-drivers:http://www.bean.org/drivers/drivpak.drv > > and the openslp docs > > service:weather.nasa:wtp://weather.nasa.com:12000 > service:weather.nasa:swtp://weather.nasa.com:12001 > service:chat.superchat://chat.superchat.com > > And going by how naming authority stuff goes. the following should be valid > too: > > service:x-private.name.authority:protocol://address:8888 > service:x-my-fancy-service.norton.ian:http://this.is.my.server > > Regards > > Ian |