Skip to content

Commit

Permalink
packetbeat/beater: make sure Npcap installation runs before interface…
Browse files Browse the repository at this point in the history
…s are needed (#30396) (#30410)

Previously installNpcap was run after Create, which depends on having interfaces up
to establish sniffers, and so was too late. So move the call to the front of Create
to ensure that the library is installed by the time that it is needed.

(cherry picked from commit 0c187d5)

Co-authored-by: Dan Kortschak <[email protected]>
  • Loading branch information
mergify[bot] and efd6 authored Feb 15, 2022
1 parent bd983fe commit f26e761
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d

*Packetbeat*

- Add automated OEM Npcap installation handling. {pull}29112[29112]
- Add automated OEM Npcap installation handling. {pull}29112[29112] {pull}30396[30396]
- Add support for capturing TLS random number and OCSP status request details. {issue}29962[29962] {pull}30102[30102]

*Functionbeat*
Expand Down
6 changes: 0 additions & 6 deletions packetbeat/beater/packetbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@ func (pb *packetbeat) Run(b *beat.Beat) error {
}
}()

// Install Npcap if needed.
err := installNpcap(b)
if err != nil {
return err
}

if !b.Manager.Enabled() {
return pb.runStatic(b, pb.factory)
}
Expand Down
6 changes: 6 additions & 0 deletions packetbeat/beater/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ func (p *processorFactory) Create(pipeline beat.PipelineConnector, cfg *common.C
return nil, err
}

// Install Npcap if needed.
err = installNpcap(p.beat)
if err != nil {
return nil, err
}

publisher, err := publish.NewTransactionPublisher(
p.beat.Info.Name,
p.beat.Publisher,
Expand Down

0 comments on commit f26e761

Please sign in to comment.