summaryrefslogtreecommitdiff
path: root/trafgen.c
diff options
context:
space:
mode:
authorQuentin Chateau <quentin.chateau@gmail.com>2019-04-09 23:19:42 +0200
committerTobias Klauser <tklauser@distanz.ch>2019-04-10 12:09:58 +0200
commit6fc3bdfd38617a8ceded73f957ec4e4df9bee6db (patch)
treeea8fd9f198da773bd6ae568a8d46c2524a4695be /trafgen.c
parent686c6990819c9a9da5f86698333a7ab2dcfdc7f9 (diff)
trafgen: fix -t 0 option to use sendto
Currently, using -t 0 option calls shaper_set_delay with 0 sec and 0 ns, which results in sh->type to be SHAPER_NONE. This in turn causes trafgen to use TX_RING. Expected behavior, from "man trafgen": If this option is given, then instead of packet(7)'s TX_RING interface, trafgen will use sendto(2) I/O for network packets, even if the argument is 0. This patch forces sh->type to be set to SHAPER_DELAY even if the delay is 0. shaper_delay already handles the case where sh->type is SHAPER_DELAY and the delay is 0. Fixes #208 Signed-off-by: Quentin Chateau <quentin.chateau@gmail.com> [tklauser: adjusted commit message to include change description] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'trafgen.c')
-rw-r--r--trafgen.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/trafgen.c b/trafgen.c
index e628646..78be711 100644
--- a/trafgen.c
+++ b/trafgen.c
@@ -567,11 +567,6 @@ static void shaper_init(struct shaper *sh)
static void shaper_set_delay(struct shaper *sh, time_t sec, long int ns)
{
- if (!(sec | ns)) {
- sh->type = SHAPER_NONE;
- return;
- }
-
sh->type = SHAPER_DELAY;
sh->delay.tv_sec = sec;
sh->delay.tv_nsec = ns;