summaryrefslogtreecommitdiff
path: root/net/siproxd/files/patch-src_utils.c
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2005-04-09 20:04:22 +0000
committerPav Lucistnik <pav@FreeBSD.org>2005-04-09 20:04:22 +0000
commit004e68b8d6af3a54a1daeaf2e8c982bcdb00fa59 (patch)
tree5da9d7ff9ce5ee41b50a3dfe814901e81201f22e /net/siproxd/files/patch-src_utils.c
parent- Fix plist (diff)
- Update to 0.5.10
- Patch for libosip2-2.2.x PR: ports/79720 Submitted by: Frank W. Josellis <frank@dynamical-systems.org> (maintainer)
Notes
Notes: svn path=/head/; revision=132826
Diffstat (limited to '')
-rw-r--r--net/siproxd/files/patch-src_utils.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/net/siproxd/files/patch-src_utils.c b/net/siproxd/files/patch-src_utils.c
new file mode 100644
index 000000000000..346d40a23e73
--- /dev/null
+++ b/net/siproxd/files/patch-src_utils.c
@@ -0,0 +1,60 @@
+--- src/utils.c.orig Sat Jan 8 11:05:13 2005
++++ src/utils.c Tue Mar 1 22:36:48 2005
+@@ -44,7 +44,7 @@
+ #include "siproxd.h"
+ #include "log.h"
+
+-static char const ident[]="$Id: utils.c,v 1.41 2005/01/08 10:05:13 hb9xar Exp $";
++static char const ident[]="$Id: utils.c,v 1.42 2005/03/01 21:36:48 hb9xar Exp $";
+
+ /* configuration storage */
+ extern struct siproxd_config configuration;
+@@ -288,6 +288,48 @@
+ passwd->pw_uid, (sts==0)?"Ok":"Failed");
+ }
+ }
++}
++
++
++/*
++ * get_interface_ip:
++ * fetches own IP address by interface INBOUND/OUTBOUND
++ *
++ * STS_SUCCESS on returning a valid IP and interface is UP
++ * STS_FAILURE if interface is DOWN or other problem
++ */
++int get_interface_ip(int interface, struct in_addr *retaddr) {
++ int sts=STS_FAILURE;
++ char *tmp=NULL;
++
++ if (interface == IF_INBOUND) {
++ tmp = configuration.inbound_if;
++ } else if (interface == IF_OUTBOUND) {
++ tmp = configuration.outbound_if;
++ }
++
++ if ((interface == IF_OUTBOUND) &&
++ (configuration.outbound_host) &&
++ (strcmp(configuration.outbound_host, "")!=0)) {
++ DEBUGC(DBCLASS_DNS, "fetching outbound IP by HOSTNAME");
++ if (retaddr) {
++ sts = get_ip_by_host(configuration.outbound_host, retaddr);
++ } else {
++ sts = STS_SUCCESS;
++ }
++
++ } else if (tmp && (strcmp(tmp, "")!=0)) {
++ DEBUGC(DBCLASS_DNS, "fetching interface IP by INTERFACE [%i]", interface);
++ sts = get_ip_by_ifname(tmp, retaddr);
++ if (sts != STS_SUCCESS) {
++ ERROR("can't find interface %s - configuration error?", tmp);
++ }
++
++ } else {
++ ERROR("Don't know what interface to look for - configuration error?");
++ }
++
++ return sts;
+ }
+
+