Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed socket scanning for tcp6 #4442

Merged
merged 4 commits into from
Jun 8, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ https://github.com/elastic/beats/compare/v6.0.0-alpha1...master[Check the HEAD d

*Packetbeat*
- Enable memcache filtering only if a port is specified in the config file. {issue}4335[4335]
- Enabled /proc/net/tcp6 scanning and fixed ip v6 parsing. {pull}4442[4442]

*Winlogbeat*

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