On 2017-06-13 at 06:13:58 +0200, Vadim Kochan <[email protected]> wrote:
> Simplify a bit of creation rfraw device by delegating it to the dev_io
> API, also in case the output device is pcap file the --rfraw option
> sets the link type to ieee80211 radio tap.
>
> Signed-off-by: Vadim Kochan <[email protected]>
> ---
> trafgen.8 | 3 ++-
> trafgen.c | 25 +++++++++----------------
> trafgen_dev.c | 36 +++++++++++++++++++++++++++++++++++-
> trafgen_dev.h | 4 +++-
> 4 files changed, 49 insertions(+), 19 deletions(-)
>
[...]
> diff --git a/trafgen_dev.c b/trafgen_dev.c
> index cd99a0c..46fb897 100644
> --- a/trafgen_dev.c
> +++ b/trafgen_dev.c
> @@ -16,6 +16,8 @@
> #include "xmalloc.h"
> #include "pcap_io.h"
> #include "built_in.h"
> +#include "mac80211.h"
> +#include "linktype.h"
> #include "trafgen_dev.h"
>
> static int dev_pcap_open(struct dev_io *dev, const char *name, enum
> dev_io_mode_t mode)
> @@ -164,9 +166,35 @@ static int dev_net_write(struct dev_io *dev, const
> uint8_t *buf, size_t len)
> return sendto(dev->fd, buf, len, 0, (struct sockaddr *) &saddr,
> sizeof(saddr));
> }
>
> +static int dev_net_set_link_type(struct dev_io *dev, int link_type)
> +{
> + if (link_type != LINKTYPE_IEEE802_11 && link_type !=
> LINKTYPE_IEEE802_11_RADIOTAP)
> + return 0;
> +
> + dev->trans = xstrdup(dev->name);
> + xfree(dev->name);
> +
> + enter_rfmon_mac80211(dev->trans, &dev->name);
> + dev->ifindex = __device_ifindex(dev->name);
> + dev->dev_type = device_type(dev->name);
> + sleep(0);
Is this sleep really needed? It was already there in the original code,
but I guess it can be omitted...
--
You received this message because you are subscribed to the Google Groups
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.