tcpdump mailing list archives

Re: configure script problem while working on extention


From: Christian via tcpdump-workers <tcpdump-workers () lists tcpdump org>
Date: Mon, 15 Aug 2022 14:31:18 +0200

--- Begin Message --- From: Christian <chris () argonautx net>
Date: Mon, 15 Aug 2022 14:31:18 +0200
Then I opened the tcpdump.zip archive
(.zip?  Not .tar.gz?  The current releases from

        https://www.tcpdump.org/index.html#latest-releases

are provided in .tar.gz form, as are all the other release in

        https://www.tcpdump.org/release/

Gzipped tarballs are probably easier to extract on a UN*X, as they're likely to have either a version of tar that reads gzipped files or 
have gzcat and tar; to unpack a zip archive requires a command such as unzip or a GUI tool that unpacks zip archives.  Perhaps you mean 
".zip archive" in a metaphorical sense of "some form of archive"?  Or is this a ZIP archive provided by somebody other than 
tcpdump.org?)


Okay I was not quite consequent, got the sources of libpcap from git but tcpdump from the zip archive of github. But today I tried it again with git. And this time I didn't put it into the libpcap directory but into the parent directory, so that they have the same parent. But the result remains the same.


No, they're not attached.  Either you forgot to attach them or some mail software stripped the attachments.  
Michael/Denis/François - do we strip attachments at any point before sending messages to the list?

Okay bad idea of mine, attached files are hard to comment in a list anyway.

Now I paste it here:

pcap-kpnode.c

#include <stdlib.h>
#include "pcap-int.h"
#include <limits.h>
#include <string.h>
#include <stdio.h>

#define LINUX_KPNODE_DEV "/dev/kpnode0"
#define KPNODE_IFACE "kpnode"
#define KPNODE_LINE_LEN 4096

struct pcap_kpnode {

};


/* facility to add an USB device to the device list*/
static int
kpnode_dev_add(pcap_if_list_t *devlistp, int n, char *err_str)
{
    char dev_name[10];
    char dev_descr[30];
    snprintf(dev_name, 10, KPNODE_IFACE"%d", n);
    /*
     * XXX - is there any notion of "up" and "running"?
     */
    /*
     * As this refers to all buses, there's no notion of
     * "connected" vs. "disconnected", as that's a property
     * that would apply to a particular USB interface.
     */
    if (add_dev(devlistp, dev_name,
        PCAP_IF_CONNECTION_STATUS_NOT_APPLICABLE,
        "Open kpnode interface ", err_str) == NULL)
        return -1;


    return 0;
}

int
kpnode_findalldevs(pcap_if_list_t *devlistp, char *err_str)
{
    char kpnode_dev[PATH_MAX];
    char *kpnode_prefix;
    //size_t usb_mon_prefix_len;
    //struct dirent* data;
    // int ret = 0;
    //DIR* dir;
    //int n;
    //char* name;

    /*
     * We require 2.6.27 or later kernels, so we have binary-mode support.
     * What do the device names look like?
     * Split LINUX_USB_MON_DEV into a directory that we'll
     * scan and a file name prefix that we'll check for.
     */
    pcap_strlcpy(kpnode_dev, LINUX_KPNODE_DEV, sizeof kpnode_dev);
    kpnode_prefix = strrchr(kpnode_dev, '0');
    if (kpnode_prefix == NULL) {
        /*
         * This "shouldn't happen".  Just give up if it
         * does.
         */
        return 0;
    }
    *kpnode_prefix++ = '\0';
    //usb_mon_prefix_len = strlen(usb_mon_prefix);

    /*
     * Open the directory and scan it.
     */
//    dir = opendir(usb_mon_dir);
//    if (dir != NULL) {
//        while ((ret == 0) && ((data = readdir(dir)) != 0)) {
//            name = data->d_name;
//
//            /*
//             * Is this a usbmon device?
//             */
//            if (strncmp(name, usb_mon_prefix, usb_mon_prefix_len) != 0)
//                continue;    /* no */
//
//            /*
//             * What's the device number?
//             */
//            if (sscanf(&name[usb_mon_prefix_len], "%d", &n) == 0)
//                continue;    /* failed */
//
//            ret = kpnode_dev_add(devlistp, n, err_str);
//        }
//
//        closedir(dir);

    kpnode_dev_add(devlistp, 0, err_str);

    return 0;
} /* kpnode_findalldevs */

pcap_t *
kpnode_create(const char *device, char *ebuf, int *is_ours)
{
    const char *cp;
    char *cpend;
    long devnum;
    pcap_t *p;

    /* Does this look like a USB monitoring device? */
    cp = strrchr(device, '/');
    if (cp == NULL)
        cp = device;
    /* Does it begin with USB_IFACE? */
    if (strncmp(cp, KPNODE_IFACE, sizeof KPNODE_IFACE - 1) != 0) {
        /* Nope, doesn't begin with USB_IFACE */
        *is_ours = 0;
        return NULL;
    }
    /* Yes - is USB_IFACE followed by a number? */
    cp += sizeof KPNODE_IFACE - 1;
    devnum = strtol(cp, &cpend, 10);
    if (cpend == cp || *cpend != '\0') {
        /* Not followed by a number. */
        *is_ours = 0;
        return NULL;
    }
    if (devnum < 0) {
        /* Followed by a non-valid number. */
        *is_ours = 0;
        return NULL;
    }

    /* OK, it's probably ours. */
    *is_ours = 1;

    p = PCAP_CREATE_COMMON(ebuf, struct pcap_kpnode);
    if (p == NULL)
        return (NULL);

    //p->activate_op = usb_activate;
    return (p);
} /* kpnode_create */

and pcap-kpnode.h

int kpnode_findalldevs(pcap_if_list_t *devlistp, char *err_str);
pcap_t *kpnode_create(const char *device, char *ebuf, int *is_ours);

further I added into pcap.c:

100: #include "pcap-kpnode.h"

690: {kpnode_findalldevs, kpnode_create }

and in Makefile.in I added my sourcefiles

after that, I evoked make clean and the configure call again like that one before with all these switches. Then make 
and make install. The library was successfully build, also with my changes. Then I unzipped the tcpdump archive again 
to start from scratch and this time ./configure leads to that error message about no pcap_loop support. I added the 
config.log as well.

--- End Message ---
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers

Current thread: