Error compiling /usr/src/sys/contrib/pf/net/if_pfsync.c



  • I'm trying to get a build for the embedded platform.

    There seems to be a problem with kernel compilation in if_pfsync.c. I patched the code to make it compile by adding the "intrmask_t" to s, but I'm not sure this is the correct patch and why did it come out… (am I using the wrong pfsense version, or perhaps there's a broken patch somewhere in the compilation? my /etc/supfile is using RELENG_6_2 and my pfsense_local.sh is using RELENG_6_2 too).

    pfsync was patched correctly:```
    |Index: if_pfsync.c
    |===================================================================
    |RCS file: /home/ncvs/src/sys/contrib/pf/net/if_pfsync.c,v
    |retrieving revision 1.32
    |diff -u -p -r1.32 if_pfsync.c
    |--- if_pfsync.c        29 Dec 2006 13:59:47 -0000      1.32

    +++ if_pfsync.c        25 Feb 2007 16:11:03 -0000

    Patching file if_pfsync.c using Plan A...
    Hunk #1 succeeded at 154 (offset -16 lines).
    Hunk #2 succeeded at 178 (offset -16 lines).
    Hunk #3 succeeded at 226 (offset -5 lines).
    Hunk #4 succeeded at 1855 (offset -31 lines).
    Hunk #5 succeeded at 1919 (offset -5 lines).
    Hmm...  The next patch looks like a unified diff to me...
    The text leading up to this was:

    **The errors during compilation are as follows:**
    /usr/src/sys/contrib/pf/net/if_pfsync.c: In function `pfsync_ifdetach':
    /usr/src/sys/contrib/pf/net/if_pfsync.c:1866: error: `s' undeclared (first use in this function)
    /usr/src/sys/contrib/pf/net/if_pfsync.c:1866: error: (Each undeclared identifier is reported only once
    /usr/src/sys/contrib/pf/net/if_pfsync.c:1866: error: for each function it appears in.)
    *** Error code 1
    
    Stop in /usr/obj.pfSense/usr/src/sys/pfSense.6.
    *** Error code 1
    
    Stop in /usr/src.
    *** Error code 1
    
    **And I corrected the function as follows:**
    
    

    static void
    pfsync_ifdetach(void *arg, struct ifnet *ifp)
    {
            struct pfsync_softc *sc = (struct pfsync_softc *)arg;
            struct ip_moptions *imo;

    if (sc == NULL || sc->sc_sync_ifp != ifp)
                    return;        /* not for us; unlocked read */

    PF_LOCK();

    /* Deal with detaching an interface which went away. */
            sc->sc_sync_ifp = NULL;
            if (sc->sc_mbuf_net != NULL) {
                    intrmask_t s = splnet();
                    ^^^^^^ ---------------------------------> missing declaration.
                    m_freem(sc->sc_mbuf_net);
                    sc->sc_mbuf_net = NULL;
                    sc->sc_statep_net.s = NULL;
                    splx(s);
            }
            imo = &sc->sc_imo;
            if (imo->imo_num_memberships > 0) {
                    in_delmulti(imo->imo_membership[--imo->imo_num_memberships]);
                    imo->imo_multicast_ifp = NULL;
            }

    PF_UNLOCK();
    }


Log in to reply