Bug 252884 - www/gatling: does not listen on IPv4
Summary: www/gatling: does not listen on IPv4
Status: Closed Works As Intended
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-21 13:28 UTC by Song Bo Run
Modified: 2021-01-31 04:12 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (coco)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Song Bo Run 2021-01-21 13:28:03 UTC
gatling-0.15 on FreeBSD 12.1 Release, does not listen on IPv4, netstat shows:

% netstat -na | grep LISTEN | grep 80
tcp6       0      0 *.80                   *.*                    LISTEN

and:

And specifying an IPv4 address as the bind address with -i option will cause an error:

% gatling -i 127.0.0.1
socket_bind6_reuse: Can't assign requested address
Comment 1 Song Bo Run 2021-01-22 03:19:31 UTC
change the content of patch-gatling.c to the following solves the problem:

--- gatling.c.orig      2021-01-22 11:07:51.264973000 +0800
+++ gatling.c   2021-01-22 11:07:51.264931000 +0800
@@ -100,7 +100,7 @@
 int forksock[2];
 #endif

-#if defined(__OpenBSD__) || defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
 #define __broken_itojun_v6__
 #endif

@@ -1863,7 +1863,7 @@
     Y=sizeof(workgroup_utf16);
     x=workgroup;
     y=workgroup_utf16;
-#ifdef __sun__
+#if defined(__sun__) || defined(__FreeBSD__)
     if (iconv(i,(const char**)&x,&X,&y,&Y)) panic("UTF-16 conversion of workgroup failed.\n");
 #else
     if (iconv(i,&x,&X,&y,&Y)) panic("UTF-16 conversion of workgroup failed.\n");


However gatling will complain that FreeBSD does not have real IPv6 support:

% gatling
WARNING: We are taking heavy losses working around itojun KAME madness here.
         Please consider using an operating system with real IPv6 support instead!
starting_up 0 :: 8000
start_ftp 0 :: 2121

And the performance is far more bad comparing with Linux version :(
Comment 2 Song Bo Run 2021-01-22 04:13:42 UTC
Just did a little research and found that the original port will work with IPv4
if net.inet6.ip6.v6only is set to 0 (default is 1).

Additional information:

https://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/ipv6.html

inet6(4)
Comment 3 Marco Steinbach 2021-01-29 15:36:52 UTC
A note about disabling the default dual stack behaviour is certainly worth adding to a pkg-message for the 0.16 update, which I'll submit next week.

I am sorry you had to find this out on your own -- I know I had my share of hair pulling when I first ran into this :/
Comment 4 Song Bo Run 2021-01-31 04:12:54 UTC
(In reply to Marco Steinbach from comment #3)
Thanks!

There are many great tools to benchmark web servers. However as far as I know gatling is the only great tool to "benchmark" web clients, makes it a valuable tool for benchmarking web-related applications like WAF, proxies, load balancers etc.