On 07.06.2016 23:02, Stuart Henderson wrote:
> 
> btw, since this is a perfect fit for the vlan priority for pppoe
> control packets that I was looking at recently, here's a diff
> to use it there.
> 
> Index: if_sppp.h
> ===================================================================
> RCS file: /cvs/src/sys/net/if_sppp.h,v
> retrieving revision 1.24
> diff -u -p -r1.24 if_sppp.h
> --- if_sppp.h 30 May 2016 23:30:11 -0000      1.24
> +++ if_sppp.h 7 Jun 2016 20:53:28 -0000
> @@ -56,7 +56,6 @@ 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_spppsubr.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if_spppsubr.c,v
> retrieving revision 1.153
> diff -u -p -r1.153 if_spppsubr.c
> --- if_spppsubr.c     30 May 2016 23:30:10 -0000      1.153
> +++ if_spppsubr.c     7 Jun 2016 20:53:28 -0000
> @@ -914,7 +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;
> +     m->m_pkthdr.pf.prio = sp->pp_if.if_llprio;
>  
>       *mtod(m, u_int16_t *) = htons(proto);
>       lh = (struct lcp_header *)(mtod(m, u_int8_t *) + 2);
> @@ -3992,7 +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;
> +     m->m_pkthdr.pf.prio = sp->pp_if.if_llprio;
>  
>       *mtod(m, u_int16_t *) = htons(cp->proto);
>       lh = (struct lcp_header *)(mtod(m, u_int8_t *) + 2);
> 
> Index: if_pppoe.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if_pppoe.c,v
> retrieving revision 1.56
> diff -u -p -r1.56 if_pppoe.c
> --- if_pppoe.c        30 May 2016 23:30:11 -0000      1.56
> +++ if_pppoe.c        7 Jun 2016 20:53:28 -0000
> @@ -163,7 +163,7 @@ static void pppoe_timeout(void *);
>  /* sending actual protocol control packets */
>  static int pppoe_send_padi(struct pppoe_softc *);
>  static int pppoe_send_padr(struct pppoe_softc *);
> -static int pppoe_send_padt(unsigned int, u_int, const u_int8_t *);
> +static int pppoe_send_padt(unsigned int, u_int, const u_int8_t *, u_int8_t);
>  
>  /* raw output */
>  static int pppoe_output(struct pppoe_softc *, struct mbuf *);
> @@ -696,7 +696,7 @@ pppoe_data_input(struct mbuf *m)
>  #ifdef PPPOE_TERM_UNKNOWN_SESSIONS
>               printf("pppoe (data): input for unknown session 0x%x, sending 
> PADT\n",
>                   session);
> -             pppoe_send_padt(m->m_pkthdr.ph_ifidx, session, shost);
> +             pppoe_send_padt(m->m_pkthdr.ph_ifidx, session, shost, 0);
>  #endif
>               goto drop;
>       }
> @@ -1011,7 +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;
> +     m0->m_pkthdr.pf.prio = sc->sc_sppp.pp_if.if_llprio;
>  
>       /* fill in pkt */
>       p = mtod(m0, u_int8_t *);
> @@ -1170,7 +1170,8 @@ pppoe_disconnect(struct pppoe_softc *sc)
>               PPPOEDEBUG(("%s: disconnecting\n",
>                   sc->sc_sppp.pp_if.if_xname));
>               err = pppoe_send_padt(sc->sc_eth_ifidx,
> -                 sc->sc_session, (const u_int8_t *)&sc->sc_dest);
> +                 sc->sc_session, (const u_int8_t *)&sc->sc_dest,
> +                 sc->sc_sppp.pp_if.if_llprio);
>       }
>  
>       /* cleanup softc */
> @@ -1238,7 +1239,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;
> +     m0->m_pkthdr.pf.prio = sc->sc_sppp.pp_if.if_llprio;
>  
>       p = mtod(m0, u_int8_t *);
>       PPPOE_ADD_HEADER(p, PPPOE_CODE_PADR, 0, len);
> @@ -1285,7 +1286,7 @@ pppoe_send_padr(struct pppoe_softc *sc)
>  
>  /* Send a PADT packet. */
>  static int
> -pppoe_send_padt(unsigned int ifidx, u_int session, const u_int8_t *dest)
> +pppoe_send_padt(unsigned int ifidx, u_int session, const u_int8_t *dest, 
> u_int8_t prio)
>  {
>       struct ether_header *eh;
>       struct sockaddr dst;
> @@ -1302,7 +1303,7 @@ pppoe_send_padt(unsigned int ifidx, u_in
>               if_put(eth_if);
>               return (ENOBUFS);
>       }
> -     m0->m_pkthdr.pf.prio = SPPP_CTL_PRIO;
> +     m0->m_pkthdr.pf.prio = prio;
>  
>       p = mtod(m0, u_int8_t *);
>       PPPOE_ADD_HEADER(p, PPPOE_CODE_PADT, session, 0);
> 

Now that the llprio ifconfig keyword was added, could this one go in
too? It would finally solve the issue with these broken ISP devices.

Btw, I had a look at a pppoe session setup and it seems in my case, the
broken equipment is a Cisco ASR1004-1

18:42:52.761068 802.1Q vid 35 pri 0 PPPoE-Discovery
        code Offer, version 1, type 1, id 0x0000, length 109
        ...
        tag AC-Name, length 9 ASR1004-1

-- 
Unix _IS_ user friendly - it's just
selective about who its friends are!

Reply via email to