So people are running into the pppoe vlan priority problem again, some
ISP equipment doesn't like the default of IFQ_DEFPRIO (prio 3).

http://permalink.gmane.org/gmane.os.openbsd.misc/231358

As things stand, priority of normal IP packets can be set using PF
rules, but there's no way to set the priority of pppoe control frames,
and whichever way you look at it, the value we're currently using is not
optimal.

The diff below adds a #define and applies it in the appropriate places
to set priority on the control frames. I sent out similar diffs a couple
of times before but had zero feedback, the only difference with this one
is that it has been updated to apply following the removal of pppoe(4)
server.

I had a thought of using interface priority from the pppoe interface,
but after implementing that I realised it's bogus because that is for
setting *route* priorities.

So as in the previous diffs it's still hard coded to 7 at present -
highest priority, "Network Control" - which is most appropriate for
these frames in normal conditions.

People having the problem where they require 0 in the vlan header will
need to change the #define to SPPP_CTL_PRIO 1, and use a PF rule like
"match on pppoe set prio 1". (Yes, 1, not 0; IEEE 802.1Q-2014 table I-2).
For those people the advantage of this diff over the other one is that
in other cases vlan priorities will still work as expected.

Any comments?


Index: if_sppp.h
===================================================================
RCS file: /cvs/src/sys/net/if_sppp.h,v
retrieving revision 1.23
diff -u -p -r1.23 if_sppp.h
--- if_sppp.h   11 Nov 2015 01:49:17 -0000      1.23
+++ if_sppp.h   30 May 2016 15:55:35 -0000
@@ -56,6 +56,7 @@ enum ppp_phase {
 
 #define AUTHMAXLEN     256     /* including terminating '\0' */
 #define AUTHCHALEN     16      /* length of the challenge we send */
+#define SPPP_CTL_PRIO  7       /* priority to use for control packets */
 
 /*
  * Definitions to pass struct sppp data down into the kernel using the
Index: if_pppoe.c
===================================================================
RCS file: /cvs/src/sys/net/if_pppoe.c,v
retrieving revision 1.55
diff -u -p -r1.55 if_pppoe.c
--- if_pppoe.c  18 Apr 2016 14:38:08 -0000      1.55
+++ if_pppoe.c  30 May 2016 15:55:35 -0000
@@ -1011,6 +1011,7 @@ pppoe_send_padi(struct pppoe_softc *sc)
        m0 = pppoe_get_mbuf(len + PPPOE_HEADERLEN);     /* header len + payload 
len */
        if (m0 == NULL)
                return (ENOBUFS);
+       m0->m_pkthdr.pf.prio = SPPP_CTL_PRIO;
 
        /* fill in pkt */
        p = mtod(m0, u_int8_t *);
@@ -1237,6 +1238,7 @@ pppoe_send_padr(struct pppoe_softc *sc)
        m0 = pppoe_get_mbuf(len + PPPOE_HEADERLEN);
        if (m0 == NULL)
                return (ENOBUFS);
+       m0->m_pkthdr.pf.prio = SPPP_CTL_PRIO;
 
        p = mtod(m0, u_int8_t *);
        PPPOE_ADD_HEADER(p, PPPOE_CODE_PADR, 0, len);
@@ -1300,6 +1302,7 @@ pppoe_send_padt(unsigned int ifidx, u_in
                if_put(eth_if);
                return (ENOBUFS);
        }
+       m0->m_pkthdr.pf.prio = SPPP_CTL_PRIO;
 
        p = mtod(m0, u_int8_t *);
        PPPOE_ADD_HEADER(p, PPPOE_CODE_PADT, session, 0);
Index: if_spppsubr.c
===================================================================
RCS file: /cvs/src/sys/net/if_spppsubr.c,v
retrieving revision 1.152
diff -u -p -r1.152 if_spppsubr.c
--- if_spppsubr.c       2 May 2016 22:15:49 -0000       1.152
+++ if_spppsubr.c       30 May 2016 15:55:35 -0000
@@ -914,6 +914,7 @@ sppp_cp_send(struct sppp *sp, u_short pr
                return;
        m->m_pkthdr.len = m->m_len = PKTHDRLEN + LCP_HEADER_LEN + len;
        m->m_pkthdr.ph_ifidx = 0;
+       m->m_pkthdr.pf.prio = SPPP_CTL_PRIO;
 
        *mtod(m, u_int16_t *) = htons(proto);
        lh = (struct lcp_header *)(mtod(m, u_int8_t *) + 2);
@@ -3991,6 +3992,7 @@ sppp_auth_send(const struct cp *cp, stru
        if (! m)
                return;
        m->m_pkthdr.ph_ifidx = 0;
+       m->m_pkthdr.pf.prio = SPPP_CTL_PRIO;
 
        *mtod(m, u_int16_t *) = htons(cp->proto);
        lh = (struct lcp_header *)(mtod(m, u_int8_t *) + 2);

Reply via email to