Skip to content

Support create / activate paradigm for pcap objects, and RFMON#32

Closed
ograff wants to merge 1 commit intopynetwork:masterfrom
ograff:rfmon_support
Closed

Support create / activate paradigm for pcap objects, and RFMON#32
ograff wants to merge 1 commit intopynetwork:masterfrom
ograff:rfmon_support

Conversation

@ograff
Copy link
Copy Markdown
Contributor

@ograff ograff commented Aug 15, 2016

Use pcap_create, then set options, and pcap_activate when creating pcap
objects

Support setting rfmon option of pcap creation

Fixes #31

pcap.pyx Outdated
pcap_set_timeout(self.__pcap, timeout_ms)
pcap_set_immediate_mode(self.__pcap, immediate)
pcap_set_rfmon(self.__pcap, rfmon)
pcap_activate(self.__pcap)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should check for errors here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, will do!

On Aug 14, 2016 17:55, "Guy Harris" [email protected] wrote:

In pcap.pyx
#32 (comment):

@@ -197,8 +202,15 @@ cdef class pcap:

     self.__pcap = pcap_open_offline(p, self.__ebuf)
     if not self.__pcap:
  •        self.__pcap = pcap_open_live(pcap_ex_name(p), snaplen, promisc,
    
  •                                     timeout_ms, self.__ebuf)
    
  •        self.__pcap = pcap_create(pcap_ex_name(p), self.__ebuf)
    
  •        passing = True
    
  •        pcap_set_snaplen(self.__pcap, snaplen)
    
  •        pcap_set_promisc(self.__pcap, promisc)
    
  •        pcap_set_timeout(self.__pcap, timeout_ms)
    
  •        pcap_set_immediate_mode(self.__pcap, immediate)
    
  •        pcap_set_rfmon(self.__pcap, rfmon)
    
  •        pcap_activate(self.__pcap)
    

You should check for errors here.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/pynetwork/pypcap/pull/32/files/0a0962d0a7ff0a71772256c1e44770f7d7eb2c07#r74712447,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAOnrWjL_yQLZBx9j9bV-HilY0kOuZujks5qf7jrgaJpZM4JkCjY
.

@ograff
Copy link
Copy Markdown
Contributor Author

ograff commented Aug 15, 2016

I totally forgot to test that before pushing, sorry ignore that commit

Use pcap_create, then set options, and pcap_activate when creating pcap
objects

Support setting rfmon option of pcap creation

Fixes #31
@hellais
Copy link
Copy Markdown
Member

hellais commented Oct 16, 2016

In general I think it's best if when submitting pull requests you don't also regenerate the c files as it makes diffs much more messy.

ctypedef void (*pcap_handler)(void *arg, pcap_pkthdr *hdr, char *pkt)

cdef extern from "pcap.h":
pcap_t *pcap_open_live(char *device, int snaplen, int promisc,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a function that is exposed by the API and users will probably expect it we should leave it.

@hellais hellais mentioned this pull request Jan 25, 2017
5 tasks
@gpotter2
Copy link
Copy Markdown

Hello !

What is the status of this PR ?

We are calling pcap_set_rfmon in one of our implementation (secdev/scapy), so I would like to know if it will be available in next release, or if we should encourage users to skip pypcap

Thanks a lot for answering :)
Regards,

@hellais
Copy link
Copy Markdown
Member

hellais commented Feb 22, 2018

Hi @gpotter2,

I left some comments on the PR, that should be addressed or dismissed. If you have some spare time, it would be great if you could help out with that.

Testing and code review of the PR is also appreciated. That will for sure speed up the time it takes to get this into a new release.

@hellais
Copy link
Copy Markdown
Member

hellais commented Feb 22, 2018

I just merged master into this branch in pynetwork/pypcap:rfmon_support

@hellais hellais mentioned this pull request Feb 22, 2018
@hellais
Copy link
Copy Markdown
Member

hellais commented Feb 22, 2018

@ograff it seems like you didn't allow edits from the maintainer to this PR. Could you enable it? (see: https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/).

In the meantime I created a rebased PR of this in here: #67

@gpotter2 could you help out with testing the branch and ensuring that this works as expected?
If so I can, hopefully, within some reasonable amount of time work on putting out a new release with it.

@ograff
Copy link
Copy Markdown
Contributor Author

ograff commented Feb 22, 2018 via email

@hellais
Copy link
Copy Markdown
Member

hellais commented Apr 27, 2018

Closing this as it's been superseeded by the merged branch: #67.

@hellais hellais closed this Apr 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants