On Sat, 24 Sep 2016 13:08:18 -0400 (EDT)
Martin Brandenburg <[email protected]> wrote:
> On Sat, 24 Sep 2016, YASUOKA Masahiko wrote:
>> The problem doesn't repeat on my Octeon.
>>
>> Can you try the diff below?
>>
>>   - I assume the diff fixes the problem
>>   - A kernel message is added.  please let me know if it appears.
> 
> I got the message, but had another panic.
> 
> ip_etherip_output: leading space is small 2

Thanks.  The diff was wrong.  I'm sorry.

Let me update the diff.

diff --git a/sys/net/if_etherip.c b/sys/net/if_etherip.c
index ad58c52..d3b1ed6 100644
--- a/sys/net/if_etherip.c
+++ b/sys/net/if_etherip.c
@@ -352,8 +352,9 @@ ip_etherip_output(struct ifnet *ifp, struct mbuf *m)
 {
        struct etherip_softc *sc = (struct etherip_softc *)ifp->if_softc;
        struct sockaddr_in *src, *dst;
-       struct etherip_header *eip;
+       struct etherip_header eip;
        struct ip *ip;
+       int error;
 
        src = (struct sockaddr_in *)&sc->sc_src;
        dst = (struct sockaddr_in *)&sc->sc_dst;
@@ -370,21 +371,19 @@ ip_etherip_output(struct ifnet *ifp, struct mbuf *m)
 
        m->m_flags &= ~(M_BCAST|M_MCAST);
 
-       M_PREPEND(m, sizeof(struct etherip_header), M_DONTWAIT);
+       M_PREPEND(m, sizeof(struct ip) + sizeof(eip), M_DONTWAIT);
        if (m == NULL) {
                etheripstat.etherip_adrops++;
                return ENOBUFS;
        }
-       eip = mtod(m, struct etherip_header *);
-       eip->eip_ver = ETHERIP_VERSION;
-       eip->eip_res = 0;
-       eip->eip_pad = 0;
+       eip.eip_ver = ETHERIP_VERSION;
+       eip.eip_res = 0;
+       eip.eip_pad = 0;
+       error = m_copyback(m, sizeof(struct ip), sizeof(eip), (caddr_t)&eip,
+           M_DONTWAIT);
+       if (error != 0)
+               return error;
 
-       M_PREPEND(m, sizeof(struct ip), M_DONTWAIT);
-       if (m == NULL) {
-               etheripstat.etherip_adrops++;
-               return ENOBUFS;
-       }
        ip = mtod(m, struct ip *);
        memset(ip, 0, sizeof(struct ip));
 

Reply via email to