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