disable_ipv4 and disable_ipv6 controls the creation of IPv4 and IPv6
sockets, respectively.

Signed-off-by: Richard Maciel <[email protected]>
---
 src/tcsd/svrside.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/tcsd/svrside.c b/src/tcsd/svrside.c
index b54f58c..fca9d18 100644
--- a/src/tcsd/svrside.c
+++ b/src/tcsd/svrside.c
@@ -335,10 +335,19 @@ int setup_server_sockets(struct srv_sock_info ssi[])
        int i=0;
 
        ssi[0].sd = ssi[1].sd = -1;
-       // Only enqueue sockets successfully bound.
-       if (setup_ipv4_socket(&ssi[i]) == 0)
-               i++;
-       setup_ipv6_socket(&ssi[i]);
+       // Only enqueue sockets successfully bound or that weren't disabled.
+       if (tcsd_options.disable_ipv4) {
+               LogWarn("IPv4 support disabled by configuration option");
+       } else {
+               if (setup_ipv4_socket(&ssi[i]) == 0)
+                       i++;
+       }
+
+       if (tcsd_options.disable_ipv6) {
+               LogWarn("IPv6 support disabled by configuration option");
+       } else {
+               setup_ipv6_socket(&ssi[i]);
+       }
 
        // It's only a failure if both sockets are unavailable.
        if ((ssi[0].sd == -1) && (ssi[1].sd == -1)) {
-- 
1.8.1.4


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
TrouSerS-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/trousers-tech

Reply via email to