> -----Original Message-----
> From: [email protected] [mailto:rsyslog-
> [email protected]] On Behalf Of Martin Carpenter
> Sent: Monday, January 21, 2013 3:20 PM
> To: rsyslog-users
> Subject: Re: [rsyslog] rsyslog 7.2.5 net.c compilation error on solaris
> 
> On Thu, 2013-01-17 at 07:53 -0500, John Lyman wrote:
> > Thanks, I am able to compile now.  Let me know when you find a
> > function test and I can test it too.
> 
> Actually... I don't think it's ever used! getifaddrs() is called in
> getIFIPAddr() in runtime/net.c:
> 
>     static rsRetVal
>     getIFIPAddr(uchar *szif, int family, uchar *pszbuf, int lenBuf)
>     {
>         ...
> 
>         if(getifaddrs(&ifaddrs) != 0) {
>             ABORT_FINALIZE(RS_RET_ERR);
>         }
> 
> but getIFIPAddr() is never invoked. A pointer to it is assigned to the 
> interface
> struct, and that's it:
> 
>     martin $ ack-grep -a 'getifaddrs\('
>     compat/ifaddrs.h
>     76:extern int getifaddrs(struct ifaddrs **);
> 
>     compat/getifaddrs.c
>     49:getifaddrs(struct ifaddrs **ifap)
> 
>     runtime/net.c
>     1506:     if(getifaddrs(&ifaddrs) != 0) {
>     martin $
>     martin $ ack-grep -a getIFIPAddr
>     runtime/net.c
>     1499:getIFIPAddr(uchar *szif, int family, uchar *pszbuf, int lenBuf)
>     1569:     pIf->GetIFIPAddr = getIFIPAddr;
>     martin $
> 
> Yes?

Unfortunately not:

$ grep -R --include "*.[ch]" GetIFIPAddr .
./runtime/net.h:        rsRetVal (*GetIFIPAddr)(uchar *szif, int family, uchar 
*pszbuf, int lenBuf);
./runtime/glbl.c:       localRet = net.GetIFIPAddr(pNewVal, AF_UNSPEC, myIP, 
(int) sizeof(myIP));
./runtime/net.c:        pIf->GetIFIPAddr = getIFIPAddr;

It's just always referenced via the pointer, and that var name starts with 
upper case (for historical reasons). So glbl.c needs it, and if you dig into 
it, it needs this to set the IP address for locally-originating addresses.

Rainer
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to