Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #13311

pcap problem

From "Bill Cunningham" <nospam@nspam.invalid>
Newsgroups comp.os.linux.misc
Subject pcap problem
Date 2015-01-05 21:30 -0500
Organization Aioe.org NNTP Server
Message-ID <m8fhc1$d5g$1@speranza.aioe.org> (permalink)

Show all headers | View raw


    This is the code I have so far and I run into a segmentation fault. The 
debugger says it has something to do with "activate".

#include <stdio.h>
#include <pcap/pcap.h>
#include <stdlib.h>

int main()
{
    pcap_t *pp;
    char *perr;
    int stat;
    int datalink;
    char errbuf[PCAP_ERRBUF_SIZE];
    pp = pcap_create("handle", errbuf);
    if (pp = NULL) {
        fputs(errbuf, stderr);
        exit(1);
    }
    stat = pcap_activate(pp);
    if (stat != 0) {
        perr = pcap_geterr(pp);
        printf("%s\n", perr);
        exit(1);
    }
    datalink = pcap_datalink(pp);
    if (datalink = PCAP_ERROR_NOT_ACTIVATED) {
        fputs("not activated error\n", stderr);
        exit(1);
    }
    puts("fine");
    return 0;
}

Bill

Back to comp.os.linux.misc | Previous | NextNext in thread | Find similar | Unroll thread


Thread

pcap problem "Bill Cunningham" <nospam@nspam.invalid> - 2015-01-05 21:30 -0500
  Re: pcap problem John McCue <jmccue@jmclin0.bstnma.east.verizon.net> - 2015-01-06 18:09 +0000
    Re: pcap problem "Bill Cunningham" <nospam@nspam.invalid> - 2015-01-06 14:54 -0500
      Re: pcap problem Rich <rich@example.invalid> - 2015-01-06 20:05 +0000
        Re: pcap problem Richard Kettlewell <rjk@greenend.org.uk> - 2015-01-06 20:11 +0000
          Re: pcap problem Rich <rich@example.invalid> - 2015-01-06 21:22 +0000
          Re: pcap problem "Bill Cunningham" <nospam@nspam.invalid> - 2015-01-06 18:08 -0500
            Re: pcap problem Richard Kettlewell <rjk@greenend.org.uk> - 2015-01-07 09:20 +0000
      Re: pcap problem Mark Blair <mblair@quantumdata.com> - 2015-01-06 14:14 -0600
        Re: pcap problem "Bill Cunningham" <nospam@nspam.invalid> - 2015-01-06 18:05 -0500
        Re: pcap problem "Bill Cunningham" <nospam@nspam.invalid> - 2015-01-06 18:12 -0500
          Re: pcap problem Rich <rich@example.invalid> - 2015-01-06 23:37 +0000
            Re: pcap problem "Bill Cunningham" <nospam@nspam.invalid> - 2015-01-06 18:44 -0500

csiph-web