summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-12-25 13:19:27 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-12-25 13:19:27 +0000
commitc187b1f920b23af203de2f501c4c7c43beba9980 (patch)
tree6bd4e201fef04be46be0cc898cf079db7934cb71
parent28f17e2c1b3a4b0b2fbfd7e0cb21b66aa7fcdeef (diff)
downloadrsyslog-c187b1f920b23af203de2f501c4c7c43beba9980.tar.gz
rsyslog-c187b1f920b23af203de2f501c4c7c43beba9980.tar.xz
rsyslog-c187b1f920b23af203de2f501c4c7c43beba9980.zip
moved some more network code
-rw-r--r--net.c43
-rw-r--r--net.h1
-rw-r--r--syslogd.c42
-rw-r--r--syslogd.h1
4 files changed, 44 insertions, 43 deletions
diff --git a/net.c b/net.c
index f663e479..358fa0ab 100644
--- a/net.c
+++ b/net.c
@@ -698,6 +698,49 @@ finalize_it:
}
+
+/* print out which socket we are listening on. This is only
+ * a debug aid. rgerhards, 2007-07-02
+ */
+void debugListenInfo(int fd, char *type)
+{
+ char *szFamily;
+ int port;
+ struct sockaddr sa;
+ struct sockaddr_in *ipv4;
+ struct sockaddr_in6 *ipv6;
+ socklen_t saLen = sizeof(sa);
+
+ if(getsockname(fd, &sa, &saLen) == 0) {
+ switch(sa.sa_family) {
+ case PF_INET:
+ szFamily = "IPv4";
+ ipv4 = (struct sockaddr_in*) &sa;
+ port = ntohs(ipv4->sin_port);
+ break;
+ case PF_INET6:
+ szFamily = "IPv6";
+ ipv6 = (struct sockaddr_in6*) &sa;
+ port = ntohs(ipv6->sin6_port);
+ break;
+ default:
+ szFamily = "other";
+ port = -1;
+ break;
+ }
+ dbgprintf("Listening on %s syslogd socket %d (%s/port %d).\n",
+ type, fd, szFamily, port);
+ return;
+ }
+
+ /* we can not obtain peer info. We are just providing
+ * debug info, so this is no reason to break the program
+ * or do any serious error reporting.
+ */
+ dbgprintf("Listening on syslogd socket %d - could not obtain peer info.\n", fd);
+}
+
+
/* Return a printable representation of a host address.
* Now (2007-07-16) also returns the full host name (if it could be obtained)
* in the second param [thanks to mildew@gmail.com for the patch].
diff --git a/net.h b/net.h
index e909e590..9812e046 100644
--- a/net.h
+++ b/net.h
@@ -75,6 +75,7 @@ rsRetVal cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN
rsRetVal addAllowedSenderLine(char* pName, uchar** ppRestOfConfLine);
void PrintAllowedSenders(int iListToPrint);
void clearAllowedSenders ();
+void debugListenInfo(int fd, char *type);
extern int ACLAddHostnameOnFail; /* add hostname to acl when DNS resolving has failed */
extern int ACLDontResolve; /* add hostname to acl instead of resolving it to IP(s) */
diff --git a/syslogd.c b/syslogd.c
index 9bc28059..dcc27c00 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -4760,48 +4760,6 @@ int getSubString(uchar **ppSrc, char *pDst, size_t DstSize, char cSep)
}
-/* print out which socket we are listening on. This is only
- * a debug aid. rgerhards, 2007-07-02
- */
-void debugListenInfo(int fd, char *type)
-{
- char *szFamily;
- int port;
- struct sockaddr sa;
- struct sockaddr_in *ipv4;
- struct sockaddr_in6 *ipv6;
- socklen_t saLen = sizeof(sa);
-
- if(getsockname(fd, &sa, &saLen) == 0) {
- switch(sa.sa_family) {
- case PF_INET:
- szFamily = "IPv4";
- ipv4 = (struct sockaddr_in*) &sa;
- port = ntohs(ipv4->sin_port);
- break;
- case PF_INET6:
- szFamily = "IPv6";
- ipv6 = (struct sockaddr_in6*) &sa;
- port = ntohs(ipv6->sin6_port);
- break;
- default:
- szFamily = "other";
- port = -1;
- break;
- }
- dbgprintf("Listening on %s syslogd socket %d (%s/port %d).\n",
- type, fd, szFamily, port);
- return;
- }
-
- /* we can not obtain peer info. We are just providing
- * debug info, so this is no reason to break the program
- * or do any serious error reporting.
- */
- dbgprintf("Listening on syslogd socket %d - could not obtain peer info.\n", fd);
-}
-
-
/* this function pulls all internal messages from the buffer
* and puts them into the processing engine.
* We can only do limited error handling, as this would not
diff --git a/syslogd.h b/syslogd.h
index cf2cd0a5..d470504d 100644
--- a/syslogd.h
+++ b/syslogd.h
@@ -70,7 +70,6 @@ int getSubString(uchar **ppSrc, char *pDst, size_t DstSize, char cSep);
*/
void logmsgInternal(int pri, char *msg, int flags);
void logmsg(int pri, msg_t *pMsg, int flags);
-void debugListenInfo(int fd, char *type);
extern int bFinished; /* used by termination signal handler, read-only except there */
extern int AcceptRemote; /* receive messages that come via UDP - read-only after startup */