summaryrefslogtreecommitdiff
path: root/trafgen_dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'trafgen_dev.c')
-rw-r--r--trafgen_dev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/trafgen_dev.c b/trafgen_dev.c
index cd99a0c..80e7481 100644
--- a/trafgen_dev.c
+++ b/trafgen_dev.c
@@ -174,8 +174,10 @@ struct dev_io *dev_io_open(const char *name, enum dev_io_mode_t mode)
struct dev_io *dev = xzmalloc(sizeof(struct dev_io));
if (strstr(name, ".pcap")) {
+ dev->name = xstrdup(name);
dev->ops = &dev_pcap_ops;
} else if (device_mtu(name) > 0) {
+ dev->name = xstrndup(name, IFNAMSIZ);
dev->ops = &dev_net_ops;
} else {
fprintf(stderr, "No networking device or pcap file: %s\n", name);
@@ -189,7 +191,6 @@ struct dev_io *dev_io_open(const char *name, enum dev_io_mode_t mode)
}
}
- dev->name = xstrdup(name);
return dev;
};