- lastconn = ((struct ip *)&p[SLX_CHDR])->ip_p;
- hlen = ip->ip_hl;
- hlen += ((struct tcphdr *)&((int *)ip)[hlen])->th_off;
+ lastconn = EXTRACT_U_1(((const struct ip *)(p + SLX_CHDR))->ip_p);
+ ND_PRINT((ndo, "utcp %d: ", lastconn));
+ if (dir == -1) {
+ /* Direction is bogus, don't use it */
+ return;
+ }
+ hlen = IP_HL(ip);
+ hlen += TH_OFF((const struct tcphdr *)&((const int *)ip)[hlen]);