Skip to content

Commit

Permalink
Fix IPv6 MD5 Password protected BGP sessions not working
Browse files Browse the repository at this point in the history
On IPv6 the address starts later in on the struct-blob thing
that is done inside buildTCPMD5Sig(), this was discovered after
going down the rabbit hole with this code (I referanced this block
in bgp.tools'es bgp daemon) with it not working on v6.

After comparing the output of strace for bird 2 and the output
of this code, I realised the offsets were slightly different for
IPv6, I assume this was already known since there was a branch
that did the same thing for both address families
  • Loading branch information
benjojo authored and BarbarossaTM committed Dec 5, 2022
1 parent 91dfd06 commit 3390771
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/tcp/md5sig.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func buildTCPMD5Sig(addr net.IP, key string) tcpMD5sig {
if family == unix.AF_INET {
copy(t.ss[2:], addr.To4())
} else {
copy(t.ss[2:], addr.To16())
copy(t.ss[6:], addr.To16())
}

copy(t.key[0:], key)
Expand Down

0 comments on commit 3390771

Please sign in to comment.