CVSROOT: /cvs Module name: src Changes by: bl...@cvs.openbsd.org 2025/05/24 06:27:24
Modified files: sys/netinet : ip6.h tcp_input.c udp_usrreq.c sys/netinet6 : dest6.c frag6.c icmp6.c ip6_input.c mld6.c nd6_nbr.c nd6_rtr.c raw_ip6.c route6.c Log message: Pass mbuf pointer to IP6_EXTHDR_GET() macro. Passing an mbuf pointer instead of mbuf to IP6_EXTHDR_GET() simplifies memory management. m_pulldown() may free the mbuf and the macro sets m to NULL. This is not obvious, it is cleaner to pass a pointer if the value may be modified. Another reason for this change is that I am slowly converting the protocol input functions to deal with mbuf pointer instead of mbuf. m_pullup() and m_pulldown() may modify or free the mbuf, and then dangling pointers are lying around in the callers. We had problmes with that before. Prefer to adjust all pointers, which is possible when using *mp instead of m and setting mp to NULL after free. Then either a NULL dereference happens or a double free is ignored. Both are much easier to deal with than a use after free. OK claudio@