Skip to content

Commit

Permalink
Fixed socket scanning for tcp6 (elastic#4442)
Browse files Browse the repository at this point in the history
* Fixed socket scanning for tcp6

* Fixed ip6 parsing
  • Loading branch information
tomaszrichert authored and exekias committed Jun 8, 2017
1 parent 2ad927d commit 1426260
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ https://github.com/elastic/beats/compare/v6.0.0-alpha1...master[Check the HEAD d

*Packetbeat*

- Enabled /proc/net/tcp6 scanning and fixed ip v6 parsing. {pull}4442[4442]

*Winlogbeat*

==== Added
Expand Down Expand Up @@ -113,7 +115,7 @@ https://github.com/elastic/beats/compare/v6.0.0-alpha1...v6.0.0-alpha2[View comm
- Fix type of field `haproxy.stat.check.health.last`. {issue}4407[4407]
*Packetbeat*
- Enable memcache filtering only if a port is specified in the config file. {issue}4335[4335]
- Enable memcache filtering only if a port is specified in the config file. {issue}4335[4335]
==== Added
Expand Down
6 changes: 3 additions & 3 deletions packetbeat/procs/procs.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func hexToIpv4(word string) (net.IP, error) {
func hexToIpv6(word string) (net.IP, error) {
p := make(net.IP, net.IPv6len)
for i := 0; i < 4; i++ {
part, err := strconv.ParseInt(word[i*8:(i+1)*8], 16, 32)
part, err := strconv.ParseUint(word[i*8:(i+1)*8], 16, 32)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -324,12 +324,12 @@ func (proc *ProcessesWatcher) updateMap() {
}

func socketsFromProc(filename string, ipv6 bool) ([]*socketInfo, error) {
file, err := os.Open("/proc/net/tcp")
file, err := os.Open(filename)
if err != nil {
return nil, err
}
defer file.Close()
return parseProcNetTCP(file, false)
return parseProcNetTCP(file, ipv6)
}

// Parses the /proc/net/tcp file
Expand Down

0 comments on commit 1426260

Please sign in to comment.