From fbfbce8ae9a979b8db91e6180c13b56b31d260e0 Mon Sep 17 00:00:00 2001 From: Jack F Vogel Date: Wed, 19 Jan 2011 18:20:11 +0000 Subject: [PATCH] Fix for kern/152853, pullup at the wrong point is breaking UDP. Thanks to Petr Lampa for the patch. --- sys/dev/e1000/if_em.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index f2e52572d00..6508ae23252 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1820,12 +1820,12 @@ em_xmit(struct tx_ring *txr, struct mbuf **m_headp) } ip = (struct ip *)(mtod(m_head, char *) + ip_off); poff = ip_off + (ip->ip_hl << 2); - m_head = m_pullup(m_head, poff + sizeof(struct tcphdr)); - if (m_head == NULL) { - *m_headp = NULL; - return (ENOBUFS); - } if (do_tso) { + m_head = m_pullup(m_head, poff + sizeof(struct tcphdr)); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } tp = (struct tcphdr *)(mtod(m_head, char *) + poff); /* * TSO workaround: @@ -1849,6 +1849,11 @@ em_xmit(struct tx_ring *txr, struct mbuf **m_headp) tp->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(IPPROTO_TCP)); } else if (m_head->m_pkthdr.csum_flags & CSUM_TCP) { + m_head = m_pullup(m_head, poff + sizeof(struct tcphdr)); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } tp = (struct tcphdr *)(mtod(m_head, char *) + poff); m_head = m_pullup(m_head, poff + (tp->th_off << 2)); if (m_head == NULL) {