Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make --nstreams and --xbind options bound to SCTP support #981

Open
PatrikMosko opened this issue Apr 19, 2020 · 2 comments
Open

Make --nstreams and --xbind options bound to SCTP support #981

PatrikMosko opened this issue Apr 19, 2020 · 2 comments
Assignees

Comments

@PatrikMosko
Copy link

Context

  • Version of iperf3:
    iperf3-3.7

  • Hardware:
    Lenovo ThinkPad T470S

  • Operating system (and distribution, if any):
    Fedora 31

  • Other relevant information (for example, non-default compilers,
    libraries, cross-compiling, etc.):
    uname: Linux gdpr 5.5.13-200.fc31.x86_64 setting of window size should be explicit #1 SMP Wed Mar 25 21:55:30 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Bug Report

Put the options tied-to SCTP functionality to the SCTP support.
Options --nstreams and --xbind are present and can be invoked even when iperf3 is compiled without SCTP support, which may be missleading for someone. This is not exactly an issue or regression but I saw it, didn't liked it, so here we are.

  • Expected Behavior
    (--without-sctp):
    $iperf3 -c --nstreams
    iperf3: unrecognized option '--nstreams'

  • Actual Behavior
    iperf3 would run normally, --nstreams is ignored

  • Possible Solution

--- ../BUILD/iperf-3.5/src/iperf_api.c  2018-02-28 16:24:06.000000000 -0500
+++ /iperf_api.c        2020-04-15 00:25:10.067965910 -0400
@@ -793,13 +793,13 @@
 #endif /* HAVE_SCTP */

             case OPT_NUMSTREAMS:
-#if defined(linux) || defined(__FreeBSD__)
+#if defined(HAVE_SCTP) && (defined(linux) || defined(__FreeBSD__))
                 test->settings->num_ostreams = unit_atoi(optarg);
                 client_flag = 1;
-#else /* linux */
+#else
                 i_errno = IEUNIMP;
                 return -1; 
-#endif /* linux */
+#endif
             case 'b':
                slash = strchr(optarg, '/');
                if (slash) {
@@ -918,6 +918,7 @@
 #endif /* HAVE_FLOWLABEL */
                 break;
             case 'X':
+#if defined(HAVE_SCTP)
                xbe = (struct xbind_entry *)malloc(sizeof(struct xbind_entry));
                 if (!xbe) {
                    i_errno = IESETSCTPBINDX;
@@ -931,6 +932,10 @@
                 }
                TAILQ_INSERT_TAIL(&test->xbind_addrs, xbe, link);
                 break;
+#else /* HAVE_SCTP */
+                i_errno = IEUNIMP;
+                return -1;
+#endif /* HAVE_SCTP */
             case 'Z':
                 if (!has_sendfile()) {
                     i_errno = IENOSENDFILE;
  • note: proposed patch may be just first step to bound those options to SCTP, dunno.
@bmah888
Copy link
Contributor

bmah888 commented Apr 20, 2020

Thanks for the patch! This looks like it'll do the right thing, although I haven't actually tried compiling or running it yet.

@bmah888
Copy link
Contributor

bmah888 commented Apr 21, 2020

Now that I'm staring at this, I'm trying to figure out how to recreate your problem. If you compile iperf3 where there's no SCTP support, then the command-line options for SCTP aren't compiled in (see iperf_parse_arguments() at around line 838 in iperf_api.c). So assuming you run on the same system, it shouldn't allow the user to specify --sctp, --numstreams, or -X/--xbind. It's true that (in the current code) the code that handles those command-line arguments is there, but they cann't get called because those options weren't included in the getopt_long().

If you compile on an SCTP-aware machine, everything will be activated, but if you then take the executable to a non-SCTP machine (same OS and architecture), it should try to run but will probably barf when it goes to open the data sockets.

So I'm trying to understand how you got an instance of iperf3 that's behaving the way you described. More details to help me reproduce the problem would be greatly appreciated.

Also you mentioned --without-sctp, which would be a great configure-time parameter, except our configure script doesn't support that. (There probably should be a way to disable SCTP support explicitly, but we don't have one.)

@bmah888 bmah888 self-assigned this Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants