]> The Tcpdump Group git mirrors - libpcap/commitdiff
linux: rename a routine to make its function clearer.
authorGuy Harris <[email protected]>
Wed, 13 Apr 2022 23:00:24 +0000 (16:00 -0700)
committerGuy Harris <[email protected]>
Wed, 13 Apr 2022 23:00:49 +0000 (16:00 -0700)
Its function is to set up the socket for capture, so call it
setup_socket().  "pf_packet" in "activate_pf_packet()" iss redundant, as
the only type of socket we now support is PF_PACKET (we dropped support
for systems without PF_PACKET sockets a while ago), and it doesn't do a
full activation, it just does some socket setup.

(cherry picked from commit 0035db9167474bfdfc4164e3aff3846b356e6d16)

pcap-linux.c

index 2f7afeebe70f950c34c59a640473613597a9ab4e..6b09c798787ebeb3028d7c7b6bd61e393ed3a220 100644 (file)
@@ -223,7 +223,7 @@ static int get_if_flags(const char *, bpf_u_int32 *, char *);
 static int is_wifi(const char *);
 static void map_arphrd_to_dlt(pcap_t *, int, const char *, int);
 static int pcap_activate_linux(pcap_t *);
-static int activate_pf_packet(pcap_t *, int);
+static int setup_socket(pcap_t *, int);
 static int setup_mmapped(pcap_t *, int *);
 static int pcap_can_set_rfmon_linux(pcap_t *);
 static int pcap_inject_linux(pcap_t *, const void *, int);
@@ -1070,7 +1070,7 @@ pcap_activate_linux(pcap_t *handle)
         * If the "any" device is specified, try to open a SOCK_DGRAM.
         * Otherwise, open a SOCK_RAW.
         */
-       ret = activate_pf_packet(handle, is_any_device);
+       ret = setup_socket(handle, is_any_device);
        if (ret < 0) {
                /*
                 * Fatal error; the return value is the error code,
@@ -1860,7 +1860,7 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype,
                 * XXX - are there any other sorts of "fake Ethernet" that
                 * have ARPHRD_ETHER but that shouldn't offer DLT_DOCSIS as
                 * a Cisco CMTS won't put traffic onto it or get traffic
-                * bridged onto it?  ISDN is handled in "activate_pf_packet()",
+                * bridged onto it?  ISDN is handled in "setup_socket()",
                 * as we fall back on cooked mode there, and we use
                 * is_wifi() to check for 802.11 devices; are there any
                 * others?
@@ -2209,7 +2209,7 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype,
                /* We need to save packet direction for IrDA decoding,
                 * so let's use "Linux-cooked" mode. Jean II
                 *
-                * XXX - this is handled in activate_pf_packet(). */
+                * XXX - this is handled in setup_socket(). */
                /* handlep->cooked = 1; */
                break;
 
@@ -2251,7 +2251,7 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype,
                 * pick up the netlink protocol type such as NETLINK_ROUTE,
                 * NETLINK_GENERIC, NETLINK_FIB_LOOKUP, etc.
                 *
-                * XXX - this is handled in activate_pf_packet().
+                * XXX - this is handled in setup_socket().
                 */
                /* handlep->cooked = 1; */
                break;
@@ -2292,7 +2292,7 @@ set_dlt_list_cooked(pcap_t *handle)
  * Returns 0 on success and a PCAP_ERROR_ value on failure.
  */
 static int
-activate_pf_packet(pcap_t *handle, int is_any_device)
+setup_socket(pcap_t *handle, int is_any_device)
 {
        struct pcap_linux *handlep = handle->priv;
        const char              *device = handle->opt.device;