On Tue, Jan 18, 2022 at 12:59:25PM +0100, Christian Ehrhardt wrote:
> If so, any volunteers to commit this?

Done.  Thanks for fixing this.

Two more things:

- We need a man page update.  I think the missing documentation
  of this feature was the reason that this bug was introduced.
- The strange M_EXT check with the XXX comment in ip input was the
  reason I looked into this topic long time ago.  I think a M_READONLY
  would make the intention more obvious.

ok?

bluhm


Index: share/man/man9/mbuf.9
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/share/man/man9/mbuf.9,v
retrieving revision 1.123
diff -u -p -r1.123 mbuf.9
--- share/man/man9/mbuf.9       8 Mar 2021 02:47:26 -0000       1.123
+++ share/man/man9/mbuf.9       13 Jan 2022 14:36:53 -0000
@@ -570,7 +570,7 @@ is freed.
 Ensure that the data in the mbuf chain starting at the beginning of
 the chain and ending at
 .Fa len
-will be put in continuous memory region.
+will be put in continuous and writable memory region.
 If memory must be allocated, then it will fail if the
 .Fa len
 argument is greater than MAXMCLBYTES.


Index: netinet/ip_input.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_input.c,v
retrieving revision 1.364
diff -u -p -r1.364 ip_input.c
--- netinet/ip_input.c  22 Nov 2021 13:47:10 -0000      1.364
+++ netinet/ip_input.c  18 Jan 2022 12:42:14 -0000
@@ -415,7 +415,7 @@ ip_input_if(struct mbuf **mp, int *offp,
                if (ipmforwarding && ip_mrouter[ifp->if_rdomain]) {
                        int error;
 
-                       if (m->m_flags & M_EXT) {
+                       if (M_READONLY(m)) {
                                if ((m = *mp = m_pullup(m, hlen)) == NULL) {
                                        ipstat_inc(ips_toosmall);
                                        goto bad;
@@ -532,7 +532,7 @@ ip_ours(struct mbuf **mp, int *offp, int
         * but it's not worth the time; just let them time out.)
         */
        if (ip->ip_off &~ htons(IP_DF | IP_RF)) {
-               if (m->m_flags & M_EXT) {               /* XXX */
+               if (M_READONLY(m)) {
                        if ((m = *mp = m_pullup(m, hlen)) == NULL) {
                                ipstat_inc(ips_toosmall);
                                return IPPROTO_DONE;

Reply via email to