Date: Sat, 21 Mar 2009 12:53:42 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r190199 - in stable/7/sys: . contrib/pf dev/cxgb netinet netinet6 netipsec Message-ID: <200903211253.n2LCrgXX036468@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bz Date: Sat Mar 21 12:53:42 2009 New Revision: 190199 URL: http://svn.freebsd.org/changeset/base/190199 Log: MFC r186141: Another step assimilating IPv[46] PCB code - directly use the inpcb names rather than the following IPv6 compat macros: in6pcb, in6p_sp, in6p_ip6_nxt, in6p_flowinfo, in6p_vflag, in6p_flags, in6p_socket, in6p_lport, in6p_fport, in6p_ppcb and sotoin6pcb(). Apart from removing duplicate code in netipsec, this is a pure whitespace, not a functional change. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/netinet/tcp_subr.c stable/7/sys/netinet/tcp_syncache.c stable/7/sys/netinet/tcp_usrreq.c stable/7/sys/netinet6/icmp6.c stable/7/sys/netinet6/in6_pcb.c stable/7/sys/netinet6/in6_pcb.h stable/7/sys/netinet6/in6_src.c stable/7/sys/netinet6/ip6_input.c stable/7/sys/netinet6/ip6_output.c stable/7/sys/netinet6/raw_ip6.c stable/7/sys/netinet6/udp6_usrreq.c stable/7/sys/netipsec/ipsec.c stable/7/sys/netipsec/key.c Modified: stable/7/sys/netinet/tcp_subr.c ============================================================================== --- stable/7/sys/netinet/tcp_subr.c Sat Mar 21 12:02:11 2009 (r190198) +++ stable/7/sys/netinet/tcp_subr.c Sat Mar 21 12:53:42 2009 (r190199) @@ -341,7 +341,7 @@ tcpip_fillheaders(struct inpcb *inp, voi ip6 = (struct ip6_hdr *)ip_ptr; ip6->ip6_flow = (ip6->ip6_flow & ~IPV6_FLOWINFO_MASK) | - (inp->in6p_flowinfo & IPV6_FLOWINFO_MASK); + (inp->inp_flow & IPV6_FLOWINFO_MASK); ip6->ip6_vfc = (ip6->ip6_vfc & ~IPV6_VERSION_MASK) | (IPV6_VERSION & IPV6_VERSION_MASK); ip6->ip6_nxt = IPPROTO_TCP; Modified: stable/7/sys/netinet/tcp_syncache.c ============================================================================== --- stable/7/sys/netinet/tcp_syncache.c Sat Mar 21 12:02:11 2009 (r190198) +++ stable/7/sys/netinet/tcp_syncache.c Sat Mar 21 12:53:42 2009 (r190199) @@ -748,8 +748,8 @@ syncache_socket(struct syncache *sc, str goto abort; } /* Override flowlabel from in6_pcbconnect. */ - inp->in6p_flowinfo &= ~IPV6_FLOWLABEL_MASK; - inp->in6p_flowinfo |= sc->sc_flowlabel; + inp->inp_flow &= ~IPV6_FLOWLABEL_MASK; + inp->inp_flow |= sc->sc_flowlabel; } else #endif { @@ -1044,7 +1044,7 @@ _syncache_add(struct in_conninfo *inc, s #ifdef INET6 if ((inc->inc_flags & INC_ISIPV6) && - (inp->in6p_flags & IN6P_AUTOFLOWLABEL)) + (inp->inp_flags & IN6P_AUTOFLOWLABEL)) autoflowlabel = 1; #endif ip_ttl = inp->inp_ip_ttl; @@ -1693,7 +1693,7 @@ syncookie_lookup(struct in_conninfo *inc #ifdef INET6 if (inc->inc_flags & INC_ISIPV6) { - if (sotoinpcb(so)->in6p_flags & IN6P_AUTOFLOWLABEL) + if (sotoinpcb(so)->inp_flags & IN6P_AUTOFLOWLABEL) sc->sc_flowlabel = md5_buffer[1] & IPV6_FLOWLABEL_MASK; } else #endif Modified: stable/7/sys/netinet/tcp_usrreq.c ============================================================================== --- stable/7/sys/netinet/tcp_usrreq.c Sat Mar 21 12:02:11 2009 (r190198) +++ stable/7/sys/netinet/tcp_usrreq.c Sat Mar 21 12:53:42 2009 (r190199) @@ -1145,9 +1145,9 @@ tcp6_connect(struct tcpcb *tp, struct so inp->in6p_faddr = sin6->sin6_addr; inp->inp_fport = sin6->sin6_port; /* update flowinfo - draft-itojun-ipv6-flowlabel-api-00 */ - inp->in6p_flowinfo &= ~IPV6_FLOWLABEL_MASK; - if (inp->in6p_flags & IN6P_AUTOFLOWLABEL) - inp->in6p_flowinfo |= + inp->inp_flow &= ~IPV6_FLOWLABEL_MASK; + if (inp->inp_flags & IN6P_AUTOFLOWLABEL) + inp->inp_flow |= (htonl(ip6_randomflowlabel()) & IPV6_FLOWLABEL_MASK); in_pcbrehash(inp); Modified: stable/7/sys/netinet6/icmp6.c ============================================================================== --- stable/7/sys/netinet6/icmp6.c Sat Mar 21 12:02:11 2009 (r190198) +++ stable/7/sys/netinet6/icmp6.c Sat Mar 21 12:53:42 2009 (r190199) @@ -1868,8 +1868,8 @@ icmp6_rip6_input(struct mbuf **mp, int o { struct mbuf *m = *mp; struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); - struct in6pcb *in6p; - struct in6pcb *last = NULL; + struct inpcb *in6p; + struct inpcb *last = NULL; struct sockaddr_in6 fromsa; struct icmp6_hdr *icmp6; struct mbuf *opts = NULL; @@ -1902,7 +1902,7 @@ icmp6_rip6_input(struct mbuf **mp, int o LIST_FOREACH(in6p, &ripcb, inp_list) { if ((in6p->inp_vflag & INP_IPV6) == 0) continue; - if (in6p->in6p_ip6_nxt != IPPROTO_ICMPV6) + if (in6p->inp_ip_p != IPPROTO_ICMPV6) continue; if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr) && !IN6_ARE_ADDR_EQUAL(&in6p->in6p_laddr, &ip6->ip6_dst)) @@ -1952,13 +1952,13 @@ icmp6_rip6_input(struct mbuf **mp, int o } if (n != NULL || (n = m_copy(m, 0, (int)M_COPYALL)) != NULL) { - if (last->in6p_flags & IN6P_CONTROLOPTS) + if (last->inp_flags & IN6P_CONTROLOPTS) ip6_savecontrol(last, n, &opts); /* strip intermediate headers */ m_adj(n, off); - SOCKBUF_LOCK(&last->in6p_socket->so_rcv); + SOCKBUF_LOCK(&last->inp_socket->so_rcv); if (sbappendaddr_locked( - &last->in6p_socket->so_rcv, + &last->inp_socket->so_rcv, (struct sockaddr *)&fromsa, n, opts) == 0) { /* should notify about lost packet */ @@ -1967,9 +1967,9 @@ icmp6_rip6_input(struct mbuf **mp, int o m_freem(opts); } SOCKBUF_UNLOCK( - &last->in6p_socket->so_rcv); + &last->inp_socket->so_rcv); } else - sorwakeup_locked(last->in6p_socket); + sorwakeup_locked(last->inp_socket); opts = NULL; } INP_RUNLOCK(last); @@ -1978,7 +1978,7 @@ icmp6_rip6_input(struct mbuf **mp, int o } INP_INFO_RUNLOCK(&ripcbinfo); if (last) { - if (last->in6p_flags & IN6P_CONTROLOPTS) + if (last->inp_flags & IN6P_CONTROLOPTS) ip6_savecontrol(last, m, &opts); /* strip intermediate headers */ m_adj(m, off); @@ -2002,15 +2002,15 @@ icmp6_rip6_input(struct mbuf **mp, int o } } } - SOCKBUF_LOCK(&last->in6p_socket->so_rcv); - if (sbappendaddr_locked(&last->in6p_socket->so_rcv, + SOCKBUF_LOCK(&last->inp_socket->so_rcv); + if (sbappendaddr_locked(&last->inp_socket->so_rcv, (struct sockaddr *)&fromsa, m, opts) == 0) { m_freem(m); if (opts) m_freem(opts); - SOCKBUF_UNLOCK(&last->in6p_socket->so_rcv); + SOCKBUF_UNLOCK(&last->inp_socket->so_rcv); } else - sorwakeup_locked(last->in6p_socket); + sorwakeup_locked(last->inp_socket); INP_RUNLOCK(last); } else { m_freem(m); Modified: stable/7/sys/netinet6/in6_pcb.c ============================================================================== --- stable/7/sys/netinet6/in6_pcb.c Sat Mar 21 12:02:11 2009 (r190198) +++ stable/7/sys/netinet6/in6_pcb.c Sat Mar 21 12:53:42 2009 (r190199) @@ -382,9 +382,9 @@ in6_pcbconnect(register struct inpcb *in inp->in6p_faddr = sin6->sin6_addr; inp->inp_fport = sin6->sin6_port; /* update flowinfo - draft-itojun-ipv6-flowlabel-api-00 */ - inp->in6p_flowinfo &= ~IPV6_FLOWLABEL_MASK; - if (inp->in6p_flags & IN6P_AUTOFLOWLABEL) - inp->in6p_flowinfo |= + inp->inp_flow &= ~IPV6_FLOWLABEL_MASK; + if (inp->inp_flags & IN6P_AUTOFLOWLABEL) + inp->inp_flow |= (htonl(ip6_randomflowlabel()) & IPV6_FLOWLABEL_MASK); in_pcbrehash(inp); @@ -402,7 +402,7 @@ in6_pcbdisconnect(struct inpcb *inp) bzero((caddr_t)&inp->in6p_faddr, sizeof(inp->in6p_faddr)); inp->inp_fport = 0; /* clear flowinfo - draft-itojun-ipv6-flowlabel-api-00 */ - inp->in6p_flowinfo &= ~IPV6_FLOWLABEL_MASK; + inp->inp_flow &= ~IPV6_FLOWLABEL_MASK; in_pcbrehash(inp); } @@ -605,7 +605,7 @@ in6_pcbnotify(struct inpcbinfo *pcbinfo, */ if (lport == 0 && fport == 0 && flowinfo && inp->inp_socket != NULL && - flowinfo == (inp->in6p_flowinfo & IPV6_FLOWLABEL_MASK) && + flowinfo == (inp->inp_flow & IPV6_FLOWLABEL_MASK) && IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, &sa6_src.sin6_addr)) goto do_notify; else if (!IN6_ARE_ADDR_EQUAL(&inp->in6p_faddr, @@ -724,7 +724,7 @@ in6_pcblookup_local(struct inpcbinfo *pc void in6_pcbpurgeif0(struct inpcbinfo *pcbinfo, struct ifnet *ifp) { - struct in6pcb *in6p; + struct inpcb *in6p; struct ip6_moptions *im6o; struct in6_multi_mship *imm, *nimm; Modified: stable/7/sys/netinet6/in6_pcb.h ============================================================================== --- stable/7/sys/netinet6/in6_pcb.h Sat Mar 21 12:02:11 2009 (r190198) +++ stable/7/sys/netinet6/in6_pcb.h Sat Mar 21 12:53:42 2009 (r190199) @@ -97,7 +97,7 @@ int in6_getpeeraddr __P((struct socket * int in6_getsockaddr __P((struct socket *so, struct sockaddr **nam)); int in6_mapped_sockaddr __P((struct socket *so, struct sockaddr **nam)); int in6_mapped_peeraddr __P((struct socket *so, struct sockaddr **nam)); -int in6_selecthlim __P((struct in6pcb *, struct ifnet *)); +int in6_selecthlim __P((struct inpcb *, struct ifnet *)); int in6_pcbsetport __P((struct in6_addr *, struct inpcb *, struct ucred *)); void init_sin6 __P((struct sockaddr_in6 *sin6, struct mbuf *m)); #endif /* _KERNEL */ Modified: stable/7/sys/netinet6/in6_src.c ============================================================================== --- stable/7/sys/netinet6/in6_src.c Sat Mar 21 12:02:11 2009 (r190198) +++ stable/7/sys/netinet6/in6_src.c Sat Mar 21 12:53:42 2009 (r190199) @@ -741,7 +741,7 @@ in6_selectroute(struct sockaddr_in6 *dst * 3. The system default hoplimit. */ int -in6_selecthlim(struct in6pcb *in6p, struct ifnet *ifp) +in6_selecthlim(struct inpcb *in6p, struct ifnet *ifp) { if (in6p && in6p->in6p_hops >= 0) Modified: stable/7/sys/netinet6/ip6_input.c ============================================================================== --- stable/7/sys/netinet6/ip6_input.c Sat Mar 21 12:02:11 2009 (r190198) +++ stable/7/sys/netinet6/ip6_input.c Sat Mar 21 12:53:42 2009 (r190199) @@ -1110,7 +1110,7 @@ ip6_savecontrol(struct inpcb *in6p, stru if (v4only) return; - if ((in6p->in6p_flags & IN6P_TCLASS) != 0) { + if ((in6p->inp_flags & IN6P_TCLASS) != 0) { u_int32_t flowinfo; int tclass; @@ -1131,7 +1131,7 @@ ip6_savecontrol(struct inpcb *in6p, stru * returned to normal user. * See also RFC 2292 section 6 (or RFC 3542 section 8). */ - if ((in6p->in6p_flags & IN6P_HOPOPTS) != 0) { + if ((in6p->inp_flags & IN6P_HOPOPTS) != 0) { /* * Check if a hop-by-hop options header is contatined in the * received packet, and if so, store the options as ancillary @@ -1183,7 +1183,7 @@ ip6_savecontrol(struct inpcb *in6p, stru } } - if ((in6p->in6p_flags & (IN6P_RTHDR | IN6P_DSTOPTS)) != 0) { + if ((in6p->inp_flags & (IN6P_RTHDR | IN6P_DSTOPTS)) != 0) { int nxt = ip6->ip6_nxt, off = sizeof(struct ip6_hdr); /* @@ -1244,7 +1244,7 @@ ip6_savecontrol(struct inpcb *in6p, stru switch (nxt) { case IPPROTO_DSTOPTS: - if (!(in6p->in6p_flags & IN6P_DSTOPTS)) + if (!(in6p->inp_flags & IN6P_DSTOPTS)) break; *mp = sbcreatecontrol((caddr_t)ip6e, elen, @@ -1255,7 +1255,7 @@ ip6_savecontrol(struct inpcb *in6p, stru mp = &(*mp)->m_next; break; case IPPROTO_ROUTING: - if (!in6p->in6p_flags & IN6P_RTHDR) + if (!in6p->inp_flags & IN6P_RTHDR) break; *mp = sbcreatecontrol((caddr_t)ip6e, elen, Modified: stable/7/sys/netinet6/ip6_output.c ============================================================================== --- stable/7/sys/netinet6/ip6_output.c Sat Mar 21 12:02:11 2009 (r190198) +++ stable/7/sys/netinet6/ip6_output.c Sat Mar 21 12:53:42 2009 (r190199) @@ -1458,7 +1458,7 @@ ip6_ctloutput(struct socket *so, struct else { /* -1 = kernel default */ in6p->in6p_hops = optval; - if ((in6p->in6p_vflag & + if ((in6p->inp_vflag & INP_IPV4) != 0) in6p->inp_ip_ttl = optval; } @@ -1466,19 +1466,19 @@ ip6_ctloutput(struct socket *so, struct #define OPTSET(bit) \ do { \ if (optval) \ - in6p->in6p_flags |= (bit); \ + in6p->inp_flags |= (bit); \ else \ - in6p->in6p_flags &= ~(bit); \ + in6p->inp_flags &= ~(bit); \ } while (/*CONSTCOND*/ 0) #define OPTSET2292(bit) \ do { \ - in6p->in6p_flags |= IN6P_RFC2292; \ + in6p->inp_flags |= IN6P_RFC2292; \ if (optval) \ - in6p->in6p_flags |= (bit); \ + in6p->inp_flags |= (bit); \ else \ - in6p->in6p_flags &= ~(bit); \ + in6p->inp_flags &= ~(bit); \ } while (/*CONSTCOND*/ 0) -#define OPTBIT(bit) (in6p->in6p_flags & (bit) ? 1 : 0) +#define OPTBIT(bit) (in6p->inp_flags & (bit) ? 1 : 0) case IPV6_RECVPKTINFO: /* cannot mix with RFC2292 */ @@ -1572,16 +1572,16 @@ do { \ * available only prior to bind(2). * see ipng mailing list, Jun 22 2001. */ - if (in6p->in6p_lport || + if (in6p->inp_lport || !IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr)) { error = EINVAL; break; } OPTSET(IN6P_IPV6_V6ONLY); if (optval) - in6p->in6p_vflag &= ~INP_IPV4; + in6p->inp_vflag &= ~INP_IPV4; else - in6p->in6p_vflag |= INP_IPV4; + in6p->inp_vflag |= INP_IPV4; break; case IPV6_RECVTCLASS: /* cannot mix with RFC2292 XXX */ @@ -1762,18 +1762,18 @@ do { \ switch (optval) { case IPV6_PORTRANGE_DEFAULT: - in6p->in6p_flags &= ~(IN6P_LOWPORT); - in6p->in6p_flags &= ~(IN6P_HIGHPORT); + in6p->inp_flags &= ~(IN6P_LOWPORT); + in6p->inp_flags &= ~(IN6P_HIGHPORT); break; case IPV6_PORTRANGE_HIGH: - in6p->in6p_flags &= ~(IN6P_LOWPORT); - in6p->in6p_flags |= IN6P_HIGHPORT; + in6p->inp_flags &= ~(IN6P_LOWPORT); + in6p->inp_flags |= IN6P_HIGHPORT; break; case IPV6_PORTRANGE_LOW: - in6p->in6p_flags &= ~(IN6P_HIGHPORT); - in6p->in6p_flags |= IN6P_LOWPORT; + in6p->inp_flags &= ~(IN6P_HIGHPORT); + in6p->inp_flags |= IN6P_LOWPORT; break; default: @@ -1885,7 +1885,7 @@ do { \ case IPV6_PORTRANGE: { int flags; - flags = in6p->in6p_flags; + flags = in6p->inp_flags; if (flags & IN6P_HIGHPORT) optval = IPV6_PORTRANGE_HIGH; else if (flags & IN6P_LOWPORT) @@ -2044,7 +2044,7 @@ ip6_raw_ctloutput(struct socket *so, str { int error = 0, optval, optlen; const int icmp6off = offsetof(struct icmp6_hdr, icmp6_cksum); - struct in6pcb *in6p = sotoin6pcb(so); + struct inpcb *in6p = sotoinpcb(so); int level, op, optname; level = sopt->sopt_level; @@ -3315,7 +3315,7 @@ ip6_splithdr(struct mbuf *m, struct ip6_ * Compute IPv6 extension header length. */ int -ip6_optlen(struct in6pcb *in6p) +ip6_optlen(struct inpcb *in6p) { int len; Modified: stable/7/sys/netinet6/raw_ip6.c ============================================================================== --- stable/7/sys/netinet6/raw_ip6.c Sat Mar 21 12:02:11 2009 (r190198) +++ stable/7/sys/netinet6/raw_ip6.c Sat Mar 21 12:53:42 2009 (r190199) @@ -156,10 +156,10 @@ rip6_input(struct mbuf **mp, int *offp, INP_INFO_RLOCK(&ripcbinfo); LIST_FOREACH(in6p, &ripcb, inp_list) { /* XXX inp locking */ - if ((in6p->in6p_vflag & INP_IPV6) == 0) + if ((in6p->inp_vflag & INP_IPV6) == 0) continue; - if (in6p->in6p_ip6_nxt && - in6p->in6p_ip6_nxt != proto) + if (in6p->inp_ip_p && + in6p->inp_ip_p != proto) continue; if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr) && !IN6_ARE_ADDR_EQUAL(&in6p->in6p_laddr, &ip6->ip6_dst)) @@ -193,12 +193,12 @@ rip6_input(struct mbuf **mp, int *offp, } else #endif /* IPSEC */ if (n) { - if (last->in6p_flags & IN6P_CONTROLOPTS || - last->in6p_socket->so_options & SO_TIMESTAMP) + if (last->inp_flags & IN6P_CONTROLOPTS || + last->inp_socket->so_options & SO_TIMESTAMP) ip6_savecontrol(last, n, &opts); /* strip intermediate headers */ m_adj(n, *offp); - if (sbappendaddr(&last->in6p_socket->so_rcv, + if (sbappendaddr(&last->inp_socket->so_rcv, (struct sockaddr *)&fromsa, n, opts) == 0) { m_freem(n); @@ -206,7 +206,7 @@ rip6_input(struct mbuf **mp, int *offp, m_freem(opts); rip6stat.rip6s_fullsock++; } else - sorwakeup(last->in6p_socket); + sorwakeup(last->inp_socket); opts = NULL; } INP_RUNLOCK(last); @@ -227,19 +227,19 @@ rip6_input(struct mbuf **mp, int *offp, } else #endif /* IPSEC */ if (last) { - if (last->in6p_flags & IN6P_CONTROLOPTS || - last->in6p_socket->so_options & SO_TIMESTAMP) + if (last->inp_flags & IN6P_CONTROLOPTS || + last->inp_socket->so_options & SO_TIMESTAMP) ip6_savecontrol(last, m, &opts); /* Strip intermediate headers. */ m_adj(m, *offp); - if (sbappendaddr(&last->in6p_socket->so_rcv, + if (sbappendaddr(&last->inp_socket->so_rcv, (struct sockaddr *)&fromsa, m, opts) == 0) { m_freem(m); if (opts) m_freem(opts); rip6stat.rip6s_fullsock++; } else - sorwakeup(last->in6p_socket); + sorwakeup(last->inp_socket); INP_RUNLOCK(last); } else { rip6stat.rip6s_nosock++; @@ -337,7 +337,7 @@ rip6_output(m, va_alist) control = va_arg(ap, struct mbuf *); va_end(ap); - in6p = sotoin6pcb(so); + in6p = sotoinpcb(so); INP_WLOCK(in6p); dst = &dstsock->sin6_addr; @@ -419,14 +419,14 @@ rip6_output(m, va_alist) * Fill in the rest of the IPv6 header fields. */ ip6->ip6_flow = (ip6->ip6_flow & ~IPV6_FLOWINFO_MASK) | - (in6p->in6p_flowinfo & IPV6_FLOWINFO_MASK); + (in6p->inp_flow & IPV6_FLOWINFO_MASK); ip6->ip6_vfc = (ip6->ip6_vfc & ~IPV6_VERSION_MASK) | (IPV6_VERSION & IPV6_VERSION_MASK); /* * ip6_plen will be filled in ip6_output, so not fill it here. */ - ip6->ip6_nxt = in6p->in6p_ip6_nxt; + ip6->ip6_nxt = in6p->inp_ip_p; ip6->ip6_hlim = in6_selecthlim(in6p, oifp); if (so->so_proto->pr_protocol == IPPROTO_ICMPV6 || @@ -577,7 +577,7 @@ rip6_attach(struct socket *so, int proto inp = (struct inpcb *)so->so_pcb; INP_INFO_WUNLOCK(&ripcbinfo); inp->inp_vflag |= INP_IPV6; - inp->in6p_ip6_nxt = (long)proto; + inp->inp_ip_p = (long)proto; inp->in6p_hops = -1; /* use kernel default */ inp->in6p_cksum = -1; inp->in6p_icmp6filt = filter; Modified: stable/7/sys/netinet6/udp6_usrreq.c ============================================================================== --- stable/7/sys/netinet6/udp6_usrreq.c Sat Mar 21 12:02:11 2009 (r190198) +++ stable/7/sys/netinet6/udp6_usrreq.c Sat Mar 21 12:53:42 2009 (r190199) @@ -147,7 +147,7 @@ udp6_append(struct inpcb *inp, struct mb } #endif opts = NULL; - if (inp->in6p_flags & IN6P_CONTROLOPTS || + if (inp->inp_flags & IN6P_CONTROLOPTS || inp->inp_socket->so_options & SO_TIMESTAMP) ip6_savecontrol(inp, n, &opts); m_adj(n, off + sizeof(struct udphdr)); @@ -251,7 +251,7 @@ udp6_input(struct mbuf **mp, int *offp, LIST_FOREACH(inp, &udb, inp_list) { if ((inp->inp_vflag & INP_IPV6) == 0) continue; - if (inp->in6p_lport != uh->uh_dport) + if (inp->inp_lport != uh->uh_dport) continue; /* * XXX: Do not check source port of incoming datagram @@ -270,7 +270,7 @@ udp6_input(struct mbuf **mp, int *offp, if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) { if (!IN6_ARE_ADDR_EQUAL(&inp->in6p_faddr, &ip6->ip6_src) || - inp->in6p_fport != uh->uh_sport) + inp->inp_fport != uh->uh_sport) continue; } @@ -549,7 +549,7 @@ udp6_output(struct inpcb *inp, struct mb fport = sin6->sin6_port; /* allow 0 port */ if (IN6_IS_ADDR_V4MAPPED(faddr)) { - if ((inp->in6p_flags & IN6P_IPV6_V6ONLY)) { + if ((inp->inp_flags & IN6P_IPV6_V6ONLY)) { /* * I believe we should explicitly discard the * packet when mapped addresses are disabled, @@ -593,7 +593,7 @@ udp6_output(struct inpcb *inp, struct mb error = EADDRNOTAVAIL; goto release; } - if (inp->in6p_lport == 0 && + if (inp->inp_lport == 0 && (error = in6_pcbsetport(laddr, inp, td->td_ucred)) != 0) goto release; } else { @@ -602,7 +602,7 @@ udp6_output(struct inpcb *inp, struct mb goto release; } if (IN6_IS_ADDR_V4MAPPED(&inp->in6p_faddr)) { - if ((inp->in6p_flags & IN6P_IPV6_V6ONLY)) { + if ((inp->inp_flags & IN6P_IPV6_V6ONLY)) { /* * XXX: this case would happen when the * application sets the V6ONLY flag after @@ -619,7 +619,7 @@ udp6_output(struct inpcb *inp, struct mb } laddr = &inp->in6p_laddr; faddr = &inp->in6p_faddr; - fport = inp->in6p_fport; + fport = inp->inp_fport; } if (af == AF_INET) @@ -639,7 +639,7 @@ udp6_output(struct inpcb *inp, struct mb * Stuff checksum and output datagram. */ udp6 = (struct udphdr *)(mtod(m, caddr_t) + hlen); - udp6->uh_sport = inp->in6p_lport; /* lport is always set in the PCB */ + udp6->uh_sport = inp->inp_lport; /* lport is always set in the PCB */ udp6->uh_dport = fport; if (plen <= 0xffff) udp6->uh_ulen = htons((u_short)plen); @@ -650,7 +650,7 @@ udp6_output(struct inpcb *inp, struct mb switch (af) { case AF_INET6: ip6 = mtod(m, struct ip6_hdr *); - ip6->ip6_flow = inp->in6p_flowinfo & IPV6_FLOWINFO_MASK; + ip6->ip6_flow = inp->inp_flow & IPV6_FLOWINFO_MASK; ip6->ip6_vfc &= ~IPV6_VERSION_MASK; ip6->ip6_vfc |= IPV6_VERSION; #if 0 /* ip6_plen will be filled in ip6_output. */ Modified: stable/7/sys/netipsec/ipsec.c ============================================================================== --- stable/7/sys/netipsec/ipsec.c Sat Mar 21 12:02:11 2009 (r190198) +++ stable/7/sys/netipsec/ipsec.c Sat Mar 21 12:53:42 2009 (r190199) @@ -207,7 +207,7 @@ SYSCTL_STRUCT(_net_inet6_ipsec6, IPSECCT static int ipsec4_setspidx_inpcb __P((struct mbuf *, struct inpcb *pcb)); #ifdef INET6 -static int ipsec6_setspidx_in6pcb __P((struct mbuf *, struct in6pcb *pcb)); +static int ipsec6_setspidx_in6pcb __P((struct mbuf *, struct inpcb *pcb)); #endif static int ipsec_setspidx __P((struct mbuf *, struct secpolicyindex *, int)); static void ipsec4_get_ulp __P((struct mbuf *m, struct secpolicyindex *, int)); @@ -315,7 +315,7 @@ ipsec_getpolicybysock(m, dir, inp, error if (inp->inp_vflag & INP_IPV6PROTO) { #ifdef INET6 *error = ipsec6_setspidx_in6pcb(m, inp); - pcbsp = inp->in6p_sp; + pcbsp = inp->inp_sp; #else *error = EINVAL; /* should not happen */ #endif @@ -515,26 +515,26 @@ ipsec4_setspidx_inpcb(m, pcb) static int ipsec6_setspidx_in6pcb(m, pcb) struct mbuf *m; - struct in6pcb *pcb; + struct inpcb *pcb; { struct secpolicyindex *spidx; int error; IPSEC_ASSERT(pcb != NULL, ("null pcb")); - IPSEC_ASSERT(pcb->in6p_sp != NULL, ("null inp_sp")); - IPSEC_ASSERT(pcb->in6p_sp->sp_out != NULL && pcb->in6p_sp->sp_in != NULL, + IPSEC_ASSERT(pcb->inp_sp != NULL, ("null inp_sp")); + IPSEC_ASSERT(pcb->inp_sp->sp_out != NULL && pcb->inp_sp->sp_in != NULL, ("null sp_in || sp_out")); - bzero(&pcb->in6p_sp->sp_in->spidx, sizeof(*spidx)); - bzero(&pcb->in6p_sp->sp_out->spidx, sizeof(*spidx)); + bzero(&pcb->inp_sp->sp_in->spidx, sizeof(*spidx)); + bzero(&pcb->inp_sp->sp_out->spidx, sizeof(*spidx)); - spidx = &pcb->in6p_sp->sp_in->spidx; + spidx = &pcb->inp_sp->sp_in->spidx; error = ipsec_setspidx(m, spidx, 1); if (error) goto bad; spidx->dir = IPSEC_DIR_INBOUND; - spidx = &pcb->in6p_sp->sp_out->spidx; + spidx = &pcb->inp_sp->sp_out->spidx; error = ipsec_setspidx(m, spidx, 1); if (error) goto bad; @@ -543,8 +543,8 @@ ipsec6_setspidx_in6pcb(m, pcb) return 0; bad: - bzero(&pcb->in6p_sp->sp_in->spidx, sizeof(*spidx)); - bzero(&pcb->in6p_sp->sp_out->spidx, sizeof(*spidx)); + bzero(&pcb->inp_sp->sp_in->spidx, sizeof(*spidx)); + bzero(&pcb->inp_sp->sp_out->spidx, sizeof(*spidx)); return error; } #endif @@ -1174,7 +1174,7 @@ ipsec_delete_pcbpolicy(inp) #ifdef INET6 int ipsec6_set_policy(in6p, optname, request, len, cred) - struct in6pcb *in6p; + struct inpcb *in6p; int optname; caddr_t request; size_t len; @@ -1193,10 +1193,10 @@ ipsec6_set_policy(in6p, optname, request /* select direction */ switch (xpl->sadb_x_policy_dir) { case IPSEC_DIR_INBOUND: - pcb_sp = &in6p->in6p_sp->sp_in; + pcb_sp = &in6p->inp_sp->sp_in; break; case IPSEC_DIR_OUTBOUND: - pcb_sp = &in6p->in6p_sp->sp_out; + pcb_sp = &in6p->inp_sp->sp_out; break; default: ipseclog((LOG_ERR, "%s: invalid direction=%u\n", __func__, @@ -1209,7 +1209,7 @@ ipsec6_set_policy(in6p, optname, request int ipsec6_get_policy(in6p, request, len, mp) - struct in6pcb *in6p; + struct inpcb *in6p; caddr_t request; size_t len; struct mbuf **mp; @@ -1220,7 +1220,7 @@ ipsec6_get_policy(in6p, request, len, mp /* sanity check. */ if (in6p == NULL || request == NULL || mp == NULL) return EINVAL; - IPSEC_ASSERT(in6p->in6p_sp != NULL, ("null in6p_sp")); + IPSEC_ASSERT(in6p->inp_sp != NULL, ("null inp_sp")); if (len < sizeof(*xpl)) return EINVAL; xpl = (struct sadb_x_policy *)request; @@ -1228,10 +1228,10 @@ ipsec6_get_policy(in6p, request, len, mp /* select direction */ switch (xpl->sadb_x_policy_dir) { case IPSEC_DIR_INBOUND: - pcb_sp = in6p->in6p_sp->sp_in; + pcb_sp = in6p->inp_sp->sp_in; break; case IPSEC_DIR_OUTBOUND: - pcb_sp = in6p->in6p_sp->sp_out; + pcb_sp = in6p->inp_sp->sp_out; break; default: ipseclog((LOG_ERR, "%s: invalid direction=%u\n", __func__, @@ -1603,14 +1603,14 @@ size_t ipsec6_hdrsiz(m, dir, in6p) struct mbuf *m; u_int dir; - struct in6pcb *in6p; + struct inpcb *in6p; { struct secpolicy *sp; int error; size_t size; IPSEC_ASSERT(m != NULL, ("null mbuf")); - IPSEC_ASSERT(in6p == NULL || in6p->in6p_socket != NULL, + IPSEC_ASSERT(in6p == NULL || in6p->inp_socket != NULL, ("socket w/o inpcb")); /* get SP for this packet */ Modified: stable/7/sys/netipsec/key.c ============================================================================== --- stable/7/sys/netipsec/key.c Sat Mar 21 12:02:11 2009 (r190198) +++ stable/7/sys/netipsec/key.c Sat Mar 21 12:53:42 2009 (r190199) @@ -1142,42 +1142,24 @@ key_freeso(struct socket *so) IPSEC_ASSERT(so != NULL, ("null so")); switch (so->so_proto->pr_domain->dom_family) { +#if defined(INET) || defined(INET6) #ifdef INET case PF_INET: - { - struct inpcb *pcb = sotoinpcb(so); - - /* Does it have a PCB ? */ - if (pcb == NULL) - return; - key_freesp_so(&pcb->inp_sp->sp_in); - key_freesp_so(&pcb->inp_sp->sp_out); - } - break; #endif #ifdef INET6 case PF_INET6: +#endif { -#ifdef HAVE_NRL_INPCB - struct inpcb *pcb = sotoinpcb(so); + struct inpcb *pcb = sotoinpcb(so); /* Does it have a PCB ? */ if (pcb == NULL) return; key_freesp_so(&pcb->inp_sp->sp_in); key_freesp_so(&pcb->inp_sp->sp_out); -#else - struct in6pcb *pcb = sotoin6pcb(so); - - /* Does it have a PCB ? */ - if (pcb == NULL) - return; - key_freesp_so(&pcb->in6p_sp->sp_in); - key_freesp_so(&pcb->in6p_sp->sp_out); -#endif } break; -#endif /* INET6 */ +#endif /* INET || INET6 */ default: ipseclog((LOG_DEBUG, "%s: unknown address family=%d.\n", __func__, so->so_proto->pr_domain->dom_family));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903211253.n2LCrgXX036468>