Hello,
On Thu, Apr 28, 2022 at 12:00:09AM +0200, Alexander Bluhm wrote:
> On Fri, Apr 22, 2022 at 07:40:17PM +0200, Alexandr Nedvedicky wrote:
> > > + case IPPROTO_ICMPV6:
> > > + if (!pf_pull_hdr(pd->m, pd->off, &icmp6, sizeof(icmp6),
> > > + NULL, reason, AF_INET6)) {
> > > + DPFPRINTF(LOG_NOTICE, "IPv6 short icmp6hdr");
> > > + return (PF_DROP);
> > > + }
> > > + /* ICMP multicast packets have router alert options */
> > > + switch (icmp6.icmp6_type) {
> > > + case MLD_LISTENER_QUERY:
> > > + case MLD_LISTENER_REPORT:
> > > + case MLD_LISTENER_DONE:
> >
> > I wonder if we should have a similar check we have for IPv4 address,
> > where we require a multicast address. for example in case of
> > MLD_LISTENER_QUERY the packet destination address should be fe80::/10.
> > I need to look at RFCs more closely first. Just asking in case someone
> > else
> > knows from top of the head.
>
> Where do we check multicast adddress for IPv4? At this point we
> are just comparing protocol and IP options. I would not make it
> more complex, so I will not add multicast adddress checks here.
>
yes, you are right there is no such check for IPv4.
I was just quickly reading RFC 3810 [1], section 5 Message Formats
reads as follows:
--------8<---------------8<-----------------8<--------
MLDv2 is a sub-protocol of ICMPv6, that is, MLDv2 message types are a
subset of ICMPv6 messages, and MLDv2 messages are identified in IPv6
packets by a preceding Next Header value of 58. All MLDv2 messages
described in this document MUST be sent with a link-local IPv6 Source
Vida & Costa Standards Track [Page 13]
RFC 3810 MLDv2 for IPv6 June 2004
Address, an IPv6 Hop Limit of 1, and an IPv6 Router Alert option
[RFC2711] in a Hop-by-Hop Options header. (The Router Alert option
is necessary to cause routers to examine MLDv2 messages sent to IPv6
multicast addresses in which the routers themselves have no
interest.) MLDv2 Reports can be sent with the source address set to
the unspecified address [RFC3513], if a valid link-local IPv6 source
address has not been acquired yet for the sending interface. (See
section 5.2.13. for details.)
--------8<---------------8<-----------------8<--------
I'm not sure if we do check for src/dst addresses and
hop limit if we process MLD message.
I'm going to look at your diff now. We can add those checks
in follow up commit in case they are missing.
regards
sashan
[1] https://www.ietf.org/rfc/rfc3810.txt