• Home
  • Raw
  • Download

Lines Matching refs:handlep

367 	struct pcap_linux *handlep = handle->priv;  in pcap_create_interface()  local
368 handlep->poll_breakloop_fd = eventfd(0, EFD_NONBLOCK); in pcap_create_interface()
528 struct pcap_linux *handlep = handle->priv; in add_mon_if() local
609 handlep->mondevice = strdup(mondevice); in add_mon_if()
610 if (handlep->mondevice == NULL) { in add_mon_if()
778 struct pcap_linux *handlep = handle->priv; in pcap_cleanup_linux() local
784 if (handlep->must_do_on_close != 0) { in pcap_cleanup_linux()
790 if (handlep->must_do_on_close & MUST_DELETE_MONIF) { in pcap_cleanup_linux()
791 ret = nl80211_init(handle, &nlstate, handlep->device); in pcap_cleanup_linux()
794 handlep->device, handlep->mondevice); in pcap_cleanup_linux()
801 handlep->mondevice, handle->errbuf); in pcap_cleanup_linux()
821 if (handlep->oneshot_buffer != NULL) { in pcap_cleanup_linux()
822 free(handlep->oneshot_buffer); in pcap_cleanup_linux()
823 handlep->oneshot_buffer = NULL; in pcap_cleanup_linux()
826 if (handlep->mondevice != NULL) { in pcap_cleanup_linux()
827 free(handlep->mondevice); in pcap_cleanup_linux()
828 handlep->mondevice = NULL; in pcap_cleanup_linux()
830 if (handlep->device != NULL) { in pcap_cleanup_linux()
831 free(handlep->device); in pcap_cleanup_linux()
832 handlep->device = NULL; in pcap_cleanup_linux()
835 close(handlep->poll_breakloop_fd); in pcap_cleanup_linux()
881 set_poll_timeout(struct pcap_linux *handlep) in set_poll_timeout() argument
886 if (handlep->timeout == 0) { in set_poll_timeout()
900 if (handlep->tp_version == TPACKET_V3 && broken_tpacket_v3) in set_poll_timeout()
901 handlep->poll_timeout = 1; /* don't block for very long */ in set_poll_timeout()
904 handlep->poll_timeout = -1; /* block forever */ in set_poll_timeout()
905 } else if (handlep->timeout > 0) { in set_poll_timeout()
912 if (handlep->tp_version == TPACKET_V3 && !broken_tpacket_v3) in set_poll_timeout()
913 handlep->poll_timeout = -1; /* block forever, let TPACKET_V3 wake us up */ in set_poll_timeout()
916 handlep->poll_timeout = handlep->timeout; /* block for that amount of time */ in set_poll_timeout()
923 handlep->poll_timeout = 0; in set_poll_timeout()
930 struct pcap_linux *handlep = handle->priv; in pcap_breakloop_linux() local
934 (void)write(handlep->poll_breakloop_fd, &value, sizeof(value)); in pcap_breakloop_linux()
948 struct pcap_linux *handlep = handle->priv; in pcap_activate_linux() local
985 handlep->device = strdup(device); in pcap_activate_linux()
986 if (handlep->device == NULL) { in pcap_activate_linux()
1010 handlep->timeout = handle->opt.timeout; in pcap_activate_linux()
1019 handlep->sysfs_dropped = linux_if_drops(handlep->device); in pcap_activate_linux()
1060 if ((status2 = iface_bind(handle->fd, handlep->ifindex, in pcap_activate_linux()
1076 switch (handlep->tp_version) { in pcap_activate_linux()
1112 struct pcap_linux *handlep = handle->priv; in linux_check_direction() local
1121 if (sll->sll_ifindex == handlep->lo_ifindex) in linux_check_direction()
1165 struct pcap_linux *handlep = handle->priv; in device_still_exists() local
1175 if (handlep->ifindex == -1) in device_still_exists()
1206 struct pcap_linux *handlep = handle->priv; in pcap_inject_linux() local
1209 if (handlep->ifindex == -1) { in pcap_inject_linux()
1219 if (handlep->cooked) { in pcap_inject_linux()
1248 struct pcap_linux *handlep = handle->priv; in pcap_stats_linux() local
1306 if_dropped = handlep->sysfs_dropped; in pcap_stats_linux()
1307 handlep->sysfs_dropped = linux_if_drops(handlep->device); in pcap_stats_linux()
1308 handlep->stat.ps_ifdrop += (u_int)(handlep->sysfs_dropped - if_dropped); in pcap_stats_linux()
1360 handlep->stat.ps_recv += kstats.tp_packets; in pcap_stats_linux()
1361 handlep->stat.ps_drop += kstats.tp_drops; in pcap_stats_linux()
1362 *stats = handlep->stat; in pcap_stats_linux()
2267 struct pcap_linux *handlep = handle->priv; in activate_pf_packet() local
2324 handlep->lo_ifindex = iface_get_id(sock_fd, "lo", handle->errbuf); in activate_pf_packet()
2339 handlep->cooked = 0; in activate_pf_packet()
2369 if (handlep->mondevice != NULL) in activate_pf_packet()
2370 device = handlep->mondevice; in activate_pf_packet()
2418 handlep->cooked = 1; in activate_pf_packet()
2464 handlep->ifindex = iface_get_id(sock_fd, device, in activate_pf_packet()
2466 if (handlep->ifindex == -1) { in activate_pf_packet()
2471 if ((err = iface_bind(sock_fd, handlep->ifindex, in activate_pf_packet()
2491 handlep->cooked = 1; in activate_pf_packet()
2504 handlep->ifindex = -1; in activate_pf_packet()
2531 mr.mr_ifindex = handlep->ifindex; in activate_pf_packet()
2566 if (handlep->cooked) { in activate_pf_packet()
2583 handlep->vlan_offset = 2 * ETH_ALEN; in activate_pf_packet()
2591 handlep->vlan_offset = SLL_HDR_LEN - 2; in activate_pf_packet()
2595 handlep->vlan_offset = -1; /* unknown */ in activate_pf_packet()
2646 struct pcap_linux *handlep = handle->priv; in setup_mmapped() local
2653 handlep->oneshot_buffer = malloc(handle->snapshot); in setup_mmapped()
2654 if (handlep->oneshot_buffer == NULL) { in setup_mmapped()
2667 free(handlep->oneshot_buffer); in setup_mmapped()
2677 free(handlep->oneshot_buffer); in setup_mmapped()
2692 set_poll_timeout(handlep); in setup_mmapped()
2707 struct pcap_linux *handlep = handle->priv; in init_tpacket() local
2751 handlep->tp_hdrlen = val; in init_tpacket()
2760 handlep->tp_version = version; in init_tpacket()
2852 struct pcap_linux *handlep = handle->priv; in create_ring() local
2920 switch (handlep->tp_version) { in create_ring()
3007 tp_hdrlen = TPACKET_ALIGN(handlep->tp_hdrlen) + sizeof(struct sockaddr_ll) ; in create_ring()
3054 handlep->tp_version); in create_ring()
3189 if (handlep->timeout > 0) { in create_ring()
3191 req.tp_retire_blk_tov = handlep->timeout; in create_ring()
3192 } else if (handlep->timeout == 0) { in create_ring()
3240 handlep->mmapbuflen = req.tp_block_nr * req.tp_block_size; in create_ring()
3241 handlep->mmapbuf = mmap(0, handlep->mmapbuflen, in create_ring()
3243 if (handlep->mmapbuf == MAP_FAILED) { in create_ring()
3268 u_char *base = &handlep->mmapbuf[i*req.tp_block_size]; in create_ring()
3284 struct pcap_linux *handlep = handle->priv; in destroy_ring() local
3298 if (handlep->mmapbuf) { in destroy_ring()
3300 (void)munmap(handlep->mmapbuf, handlep->mmapbuflen); in destroy_ring()
3301 handlep->mmapbuf = NULL; in destroy_ring()
3328 struct pcap_linux *handlep = handle->priv; in pcap_oneshot_linux() local
3331 memcpy(handlep->oneshot_buffer, bytes, h->caplen); in pcap_oneshot_linux()
3332 *sp->pkt = handlep->oneshot_buffer; in pcap_oneshot_linux()
3338 struct pcap_linux *handlep = handle->priv; in pcap_getnonblock_linux() local
3341 return (handlep->timeout<0); in pcap_getnonblock_linux()
3347 struct pcap_linux *handlep = handle->priv; in pcap_setnonblock_linux() local
3361 if (handlep->timeout >= 0) { in pcap_setnonblock_linux()
3366 handlep->timeout = ~handlep->timeout; in pcap_setnonblock_linux()
3369 if (handlep->timeout < 0) { in pcap_setnonblock_linux()
3370 handlep->timeout = ~handlep->timeout; in pcap_setnonblock_linux()
3374 set_poll_timeout(handlep); in pcap_setnonblock_linux()
3384 struct pcap_linux *handlep = handle->priv; in pcap_get_ring_frame_status() local
3388 switch (handlep->tp_version) { in pcap_get_ring_frame_status()
3407 struct pcap_linux *handlep = handle->priv; in pcap_wait_for_frames_mmap() local
3414 pollinfo[1].fd = handlep->poll_breakloop_fd; in pcap_wait_for_frames_mmap()
3465 timeout = handlep->poll_timeout; in pcap_wait_for_frames_mmap()
3476 if (handlep->netdown) { in pcap_wait_for_frames_mmap()
3575 handlep->netdown = 1; in pcap_wait_for_frames_mmap()
3607 nread = read(handlep->poll_breakloop_fd, &value, in pcap_wait_for_frames_mmap()
3676 if (handlep->netdown) { in pcap_wait_for_frames_mmap()
3697 pcap_strlcpy(ifr.ifr_name, handlep->device, in pcap_wait_for_frames_mmap()
3714 handlep->device); in pcap_wait_for_frames_mmap()
3727 handlep->netdown = 0; in pcap_wait_for_frames_mmap()
3737 if (handlep->poll_timeout == 0) in pcap_wait_for_frames_mmap()
3758 struct pcap_linux *handlep = handle->priv; in pcap_handle_packet_mmap() local
3799 sll = (void *)(frame + TPACKET_ALIGN(handlep->tp_hdrlen)); in pcap_handle_packet_mmap()
3800 if (handlep->cooked) { in pcap_handle_packet_mmap()
3821 TPACKET_ALIGN(handlep->tp_hdrlen) + in pcap_handle_packet_mmap()
3861 TPACKET_ALIGN(handlep->tp_hdrlen) + in pcap_handle_packet_mmap()
3882 if (handlep->filter_in_userland && handle->fcode.bf_insns) { in pcap_handle_packet_mmap()
3906 if (handlep->cooked) { in pcap_handle_packet_mmap()
3918 handlep->vlan_offset != -1 && in pcap_handle_packet_mmap()
3919 tp_snaplen >= (unsigned int) handlep->vlan_offset) in pcap_handle_packet_mmap()
3929 memmove(bp, bp + VLAN_TAG_LEN, handlep->vlan_offset); in pcap_handle_packet_mmap()
3934 tag = (struct vlan_tag *)(bp + handlep->vlan_offset); in pcap_handle_packet_mmap()
3974 struct pcap_linux *handlep = handle->priv; in pcap_read_linux_mmap_v2() local
4029 if (handlep->blocks_to_filter_in_userland > 0) { in pcap_read_linux_mmap_v2()
4030 handlep->blocks_to_filter_in_userland--; in pcap_read_linux_mmap_v2()
4031 if (handlep->blocks_to_filter_in_userland == 0) { in pcap_read_linux_mmap_v2()
4036 handlep->filter_in_userland = 0; in pcap_read_linux_mmap_v2()
4058 struct pcap_linux *handlep = handle->priv; in pcap_read_linux_mmap_v3() local
4064 if (handlep->current_packet == NULL) { in pcap_read_linux_mmap_v3()
4080 if (pkts == 0 && handlep->timeout == 0) { in pcap_read_linux_mmap_v3()
4092 if (handlep->current_packet == NULL) { in pcap_read_linux_mmap_v3()
4097 handlep->current_packet = h.raw + h.h3->hdr.bh1.offset_to_first_pkt; in pcap_read_linux_mmap_v3()
4098 handlep->packets_left = h.h3->hdr.bh1.num_pkts; in pcap_read_linux_mmap_v3()
4100 packets_to_read = handlep->packets_left; in pcap_read_linux_mmap_v3()
4114 struct tpacket3_hdr* tp3_hdr = (struct tpacket3_hdr*) handlep->current_packet; in pcap_read_linux_mmap_v3()
4119 handlep->current_packet, in pcap_read_linux_mmap_v3()
4131 handlep->current_packet = NULL; in pcap_read_linux_mmap_v3()
4134 handlep->current_packet += tp3_hdr->tp_next_offset; in pcap_read_linux_mmap_v3()
4135 handlep->packets_left--; in pcap_read_linux_mmap_v3()
4138 if (handlep->packets_left <= 0) { in pcap_read_linux_mmap_v3()
4147 if (handlep->blocks_to_filter_in_userland > 0) { in pcap_read_linux_mmap_v3()
4148 handlep->blocks_to_filter_in_userland--; in pcap_read_linux_mmap_v3()
4149 if (handlep->blocks_to_filter_in_userland == 0) { in pcap_read_linux_mmap_v3()
4154 handlep->filter_in_userland = 0; in pcap_read_linux_mmap_v3()
4162 handlep->current_packet = NULL; in pcap_read_linux_mmap_v3()
4171 if (pkts == 0 && handlep->timeout == 0) { in pcap_read_linux_mmap_v3()
4185 struct pcap_linux *handlep; in pcap_setfilter_linux() local
4199 handlep = handle->priv; in pcap_setfilter_linux()
4211 handlep->filter_in_userland = 1; in pcap_setfilter_linux()
4303 handlep->filter_in_userland = 0; in pcap_setfilter_linux()
4328 if (handlep->filter_in_userland) { in pcap_setfilter_linux()
4351 if (handlep->filter_in_userland) in pcap_setfilter_linux()
4401 handlep->blocks_to_filter_in_userland = handle->cc - n; in pcap_setfilter_linux()
4402 handlep->filter_in_userland = 1; in pcap_setfilter_linux()
4499 struct pcap_linux *handlep = handle->priv; in enter_rfmon_mode() local
4578 handlep->mondevice); in enter_rfmon_mode()
4587 pcap_strlcpy(ifr.ifr_name, handlep->mondevice, sizeof(ifr.ifr_name)); in enter_rfmon_mode()
4591 handlep->mondevice); in enter_rfmon_mode()
4593 handlep->mondevice); in enter_rfmon_mode()
4601 handlep->mondevice); in enter_rfmon_mode()
4603 handlep->mondevice); in enter_rfmon_mode()
4617 handlep->must_do_on_close |= MUST_DELETE_MONIF; in enter_rfmon_mode()
5098 struct pcap_linux *handlep = handle->priv; in fix_program() local
5142 if (handlep->cooked) { in fix_program()