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

Solicited multicast-address creation bugfix #16615

Merged
merged 2 commits into from
Jun 7, 2022

Conversation

NikitaKovaljov
Copy link
Contributor

@NikitaKovaljov NikitaKovaljov commented May 24, 2022

Fixes #16614

  • This change is fixing solicited-multicast address creation, by finding leading zeros in last 16 bits of link-local address and removing them.

  • This change is also follows with fully rewritten function to easier logic for understanding.

Reference to issue

Verification

  • copy ipv6_soll_mcast_addr6 function and make changes according to code down below and save it as ruby file:
def ipv6_soll_mcast_addr6(addr)
    h = addr.split(':')[-2, 2]
    m = []  
    x = h[0]
    x[0..1] = 'ff'
    m << x
    x = h[1]
    x.sub!(/^0*/, "")
    m << x
    puts 'ff02::1:' + m.join(':')
end

ipv6_soll_mcast_addr6("fe80::200:00ff:fe00:0002")
  • run ruby file
ruby file_name.rb
  • output
ff02::1:ff00:2

@gwillcox-r7
Copy link
Contributor

Code seems to work and looks correct. Those wishing to understand it more are encouraged to look at https://www.networkcomputing.com/networking/understanding-ipv6-what-solicited-node-multicast which mentions http://datatracker.ietf.org/doc/rfc4291/ section 2.7.1 as stating that the range of a solicited node multicast is from FF02:0:0:0:0:1:FF00:0000 to FF02:0:0:0:0:1:FFFF:FFFF, and if we consider that we can omit the :0: parts to shorten the length of the address that we write, the code makes sense.

Will get this landed now.

@gwillcox-r7 gwillcox-r7 merged commit a983bbd into rapid7:master Jun 7, 2022
@gwillcox-r7 gwillcox-r7 added the rn-fix release notes fix label Jun 7, 2022
@gwillcox-r7
Copy link
Contributor

Release Notes

A bug has been fixed in the IPv6 library when creating solicited-multicast addresses by finding leading zeros in last 16 bits of link-local address and removing them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug library rn-fix release notes fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improper solicited-multicast address generation in ipv6.rb
3 participants