- if ((m->m_flags & M_PKTHDR) == 0)
- panic("tuba_output");
- if (p == 0)
- panic("tuba_output 2");
- m = m_pullup(m, 40);
- if (m == 0) {
- printf("heisenberg hit us\n");
- (void)m_free(p);
- return (ENOBUFS);
- }
- n = mtod(m, struct tcpiphdr *);
- h = mtod(p, struct tcpiphdr *);
- lindex = n->ti_src.s_addr;
- findex = n->ti_dst.s_addr;
- len = m->m_pkthdr.len;
- bzero((caddr_t)h, sizeof(*h));
- h->ti_pr = ISOPROTO_TCP;
- h->ti_dst.s_addr = findex;
- h->ti_src.s_addr = lindex;
- h->ti_len = htons((u_short)len - 20);
- m->m_data += 20;
- m->m_len -= 20;
- k1 = in_cksum(m, len - 20);
- p->m_len = 20;
- p->m_next = m;
- k2 = in_cksum(p, 20);
- k3 = in_cksum(p, len);
- m->m_data -= 20;
- m->m_len += 20;
-
- if (tuba_noisy) {
- printf("old ti_sum is 0x%x\n", n->ti_sum);
- printf("in_cksum for old TCP part is 0x%x\n", k1);
- printf("in_cksum for ph(idx) is 0x%x\n", k2);
- printf("in_cksum for ph + TCP is 0x%x\n", k3);
- }