Skip to content

Commit 2a181e0

Browse files
authored
packetbeat/beater: make sure Npcap installation runs before interfaces are needed in all cases (#30438)
This is a second attempt to ensure that Npcap is correctly installed; running packetbeat managed by elastic-agent appears to have a different code path to that when running vanilla packetbeat and does not execute Create in time (at all?) to have the installer run. So move the installNpcap call to the earliest time we have all the needed information to ensure that the library is installed by the time that it is needed.
1 parent 878e778 commit 2a181e0

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

CHANGELOG.next.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...main[Check the HEAD dif
138138

139139
*Packetbeat*
140140

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

144144
*Functionbeat*

packetbeat/beater/packetbeat.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ func New(b *beat.Beat, rawConfig *common.Config) (beat.Beater, error) {
9595
return nil, err
9696
}
9797

98+
// Install Npcap if needed.
99+
err := installNpcap(b)
100+
if err != nil {
101+
return nil, err
102+
}
103+
98104
return &packetbeat{
99105
config: rawConfig,
100106
factory: factory,

packetbeat/beater/processor.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,6 @@ func (p *processorFactory) Create(pipeline beat.PipelineConnector, cfg *common.C
113113
return nil, err
114114
}
115115

116-
// Install Npcap if needed.
117-
err = installNpcap(p.beat)
118-
if err != nil {
119-
return nil, err
120-
}
121-
122116
publisher, err := publish.NewTransactionPublisher(
123117
p.beat.Info.Name,
124118
p.beat.Publisher,

0 commit comments

Comments
 (0)