diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2021-12-27 12:57:52 +0100 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2021-12-29 09:12:39 +0100 |
commit | 80f6513802c56480582c8b5baa2168b9e5268aaa (patch) | |
tree | 69753cef02ba43ca4dec30feb4ee6f6a09f47b58 | |
parent | 98cd70a4b2358d8dd1c3b6e4a061d7eaadcb3bd1 (diff) | |
download | ouroboros-80f6513802c56480582c8b5baa2168b9e5268aaa.tar.gz ouroboros-80f6513802c56480582c8b5baa2168b9e5268aaa.zip |
lib: Don't use pointer to set FRCT flags
The fccntl call FRCTSFLAGS was using a pointer to a flags so set
flags, which should just be a regular uint16_t.
For instance, the FRCTLINGER flags can now be turned off using
fccntl(fd, FRCTSFLAGS, FRCTFRESCNTL | FRCTFRTX)
leaving only resource control (flow control, FRCTFRESCNTL) and
retransmission enabled. Note that retransmission (FRCTFRTX) can't be
enabled or disabled on a live flow, it will be set on flow allocation.
Updates the man page for fccntl to add these FRCT options.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
-rw-r--r-- | doc/man/fccntl.3 | 19 | ||||
-rw-r--r-- | doc/man/flow_alloc.3 | 3 | ||||
-rw-r--r-- | src/lib/dev.c | 9 |
3 files changed, 18 insertions, 13 deletions
diff --git a/doc/man/fccntl.3 b/doc/man/fccntl.3 index 492cff46..c4706708 100644 --- a/doc/man/fccntl.3 +++ b/doc/man/fccntl.3 @@ -40,8 +40,8 @@ disables the timeout. \fBFLOWGQOSSPEC\fR - retrieve the current QoS specification of the flow. Takes a \fBqosspec_t * \fIqs\fR as third argument. -\fBFLOWSFLAGS\fR - set flow flags. Takes flow flags as third -argument. Supported flags are: +\fBFLOWSFLAGS\fR - set flow flags. Takes flow \fBuint32_t\fR +\fIflags\fR as third argument. Supported flags are: .RS 8 \fIFLOWFRDONLY\fR - set flow to read-only. @@ -67,25 +67,30 @@ no partial writes). .RE -\fBFLOWGFLAGS\fR - get the current flow flags. Takes an \fBuint32_t +\fBFLOWGFLAGS\fR - get the current flow flags. Takes an \fBuint32_t * \fIflags\fR as third argument. \fBFLOWGRXQLEN\fR - get the current number of packets in the receive -buffer. Takes a \fBsize_t \fIqlen\fR as third argument. +buffer. Takes a \fBsize_t \fIqlen\fR * as third argument. \fBFLOWGTXQLEN\fR - get the current number of packets in the transmit -buffer. Takes a \fBsize_t \fIqlen\fR as third argument. +buffer. Takes a \fBsize_t \fIqlen\fR * as third argument. -\fBFRCTGFLAGS\fR - get the current flow flags. Takes an \fBuint16_t +\fBFRCTSFLAGS\fR - set the current flow flags. Takes an \fBuint16_t \fIflags\fR as third argument. Supported flags are: .RS 8 \fIFRCTFRESCNTRL\fR - resource control enabled. -\fIFRCTFRTX\fR - retransmission enabled. +\fIFRCTFRTX\fR - retransmission enabled. Cannot be modified and will +be ignored on set. + +\fIFRCTFLINGER\fR - finish connection on flow deallocation. .RE +\fBFRCTGFLAGS\fR - get the current flow flags. Takes an \fBuint16_t * +\fIflags\fR as third argument. .SH RETURN VALUE diff --git a/doc/man/flow_alloc.3 b/doc/man/flow_alloc.3 index a357ee19..f67bf97a 100644 --- a/doc/man/flow_alloc.3 +++ b/doc/man/flow_alloc.3 @@ -59,7 +59,8 @@ The \fBflow_join\fR() function allows applications to join a broadcast flow provided by a broadcast layer. The dst is the layer name. The \fBflow_dealloc\fR() function will release any resources -associated with the flow. +associated with the flow. This call may block and keep reliable flows +active until all packets are acknowledged. A \fBqosspec_t\fR specifies the following QoS characteristics of a flow: diff --git a/src/lib/dev.c b/src/lib/dev.c index c8b7d93b..4416a03e 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -853,6 +853,7 @@ int fccntl(int fd, { uint32_t * fflags; uint16_t * cflags; + uint16_t csflags; va_list l; struct timespec * timeo; qosspec_t * qs; @@ -963,15 +964,13 @@ int fccntl(int fd, *fflags = flow->oflags; break; case FRCTSFLAGS: - cflags = va_arg(l, uint16_t *); - if (cflags == NULL) - goto einval; + csflags = (uint16_t) va_arg(l, uint32_t); if (flow->frcti == NULL) goto eperm; - frcti_setflags(flow->frcti, *cflags); + frcti_setflags(flow->frcti, csflags); break; case FRCTGFLAGS: - cflags = (uint16_t *) va_arg(l, int *); + cflags = (uint16_t *) va_arg(l, uint32_t *); if (cflags == NULL) goto einval; if (flow->frcti == NULL) |