|
@@ -306,9 +306,11 @@ func newLiveCap(device string, filter string, snapshotLen int, promisc bool) (*l
|
|
|
}
|
|
|
|
|
|
func (lc *liveCap) Setup() error {
|
|
|
- if lc.packetChan != nil {
|
|
|
- close(lc.packetChan)
|
|
|
- }
|
|
|
+ /*
|
|
|
+ if lc.packetChan != nil {
|
|
|
+ close(lc.packetChan)
|
|
|
+ }
|
|
|
+ */
|
|
|
|
|
|
if lc.handle != nil {
|
|
|
lc.handle.Close()
|
|
@@ -350,10 +352,6 @@ func liveCapture() {
|
|
|
}(closeChan)
|
|
|
|
|
|
for {
|
|
|
- if !config.Quiet {
|
|
|
- log.Printf("reading incoming HTTP requests on %s %s\n", config.Interface, config.Filter)
|
|
|
- }
|
|
|
-
|
|
|
select {
|
|
|
case <-closeChan:
|
|
|
livecap.Setup()
|
|
@@ -364,6 +362,10 @@ func liveCapture() {
|
|
|
}
|
|
|
|
|
|
func setupLiveCapture() (chan gopacket.Packet, error) {
|
|
|
+ if !config.Quiet {
|
|
|
+ log.Printf("reading incoming HTTP requests on %s %s\n", config.Interface, config.Filter)
|
|
|
+ }
|
|
|
+
|
|
|
// PCAP setup
|
|
|
//
|
|
|
handle, err := pcap.OpenLive(config.Interface, int32(config.SnapshotLen), config.Promiscuous, timeout)
|
|
@@ -371,7 +373,7 @@ func setupLiveCapture() (chan gopacket.Packet, error) {
|
|
|
return nil, err
|
|
|
// log.Fatal(err)
|
|
|
}
|
|
|
- defer handle.Close()
|
|
|
+ // defer handle.Close()
|
|
|
|
|
|
err = handle.SetBPFFilter(config.Filter)
|
|
|
if err != nil {
|