libnet_init() failed

Code:
#include <stdio.h>
#include <stdlib.h>
#include <libnet.h>

int
main (int argc, char *argv[])
{
  libnet_t *l;            /* libnet context */
  char errbuf[LIBNET_ERRBUF_SIZE];    /* error messages */
  int r;            /* generic return value */

  char *dev=libnet_getdevice(l);

  l = libnet_init (LIBNET_RAW4, dev, errbuf);

  if (l == NULL)
  {
    fprintf (stderr, "Error opening context: %s", errbuf);
    exit (1);
  }

  libnet_destroy (l);
  system("pause");
  return 0;
}

Habe auch probiert:
[code]
l = libnet_init (LIBNET_RAW4, NULL, errbuf);
l = libnet_init (LIBNET_RAW4, 0, errbuf);
l = libnet_init (LIBNET_RAW4, "10.0.2.15", errbuf);
[/CODE]

Ausgabe:
Code:
Error opening context: libnet_open_link(): NULL device
bzw.
Error opening context: libnet_open_link(): unable to open the driver, error Code
 : 14

Bei

char *dev=libnet_getdevice(l);
l = libnet_init (LIBNET_LINK, dev, errbuf);

merkert er nicht.

Kann mir wer helfen?

MFG
bl0xx
 
ja
Code:
[FONT=monospace]li[/FONT]bnet_getdevice(l)
gibt NULL zurück :/

wenn ich
Code:
char *dev = device->name;
versuche
Code:
error: 'device' undeclared (first use in this function)|

edit:\\ nehme jetzt LIBNET_LINK und baue den ethernet rahmen einfach auch noch mit, LIBNET_IPV4 will einfach nicht
 
Zuletzt bearbeitet:
Zurück
Oben