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. Discussed with: rwatson Reviewed by: rwatson (version before review requested changes) MFC after: 4 weeks (set the timer and see then)
This commit is contained in:
parent
cde74953ae
commit
fc384fa5d6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=186141
@ -434,7 +434,7 @@ tcpip_fillheaders(struct inpcb *inp, void *ip_ptr, void *tcp_ptr)
|
||||
|
||||
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;
|
||||
|
@ -708,8 +708,8 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
|
||||
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
|
||||
{
|
||||
@ -994,7 +994,7 @@ _syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
|
||||
|
||||
#ifdef INET6
|
||||
if (inc->inc_isipv6 &&
|
||||
(inp->in6p_flags & IN6P_AUTOFLOWLABEL))
|
||||
(inp->inp_flags & IN6P_AUTOFLOWLABEL))
|
||||
autoflowlabel = 1;
|
||||
#endif
|
||||
ip_ttl = inp->inp_ip_ttl;
|
||||
@ -1654,7 +1654,7 @@ syncookie_lookup(struct in_conninfo *inc, struct syncache_head *sch,
|
||||
|
||||
#ifdef INET6
|
||||
if (inc->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
|
||||
|
@ -1167,9 +1167,9 @@ tcp6_connect(struct tcpcb *tp, struct sockaddr *nam, struct thread *td)
|
||||
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);
|
||||
|
||||
|
@ -1899,8 +1899,8 @@ icmp6_rip6_input(struct mbuf **mp, int off)
|
||||
INIT_VNET_INET6(curvnet);
|
||||
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;
|
||||
@ -1933,7 +1933,7 @@ icmp6_rip6_input(struct mbuf **mp, int off)
|
||||
LIST_FOREACH(in6p, &V_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))
|
||||
@ -1983,13 +1983,13 @@ icmp6_rip6_input(struct mbuf **mp, int off)
|
||||
}
|
||||
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 */
|
||||
@ -1998,9 +1998,9 @@ icmp6_rip6_input(struct mbuf **mp, int off)
|
||||
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);
|
||||
@ -2009,7 +2009,7 @@ icmp6_rip6_input(struct mbuf **mp, int off)
|
||||
}
|
||||
INP_INFO_RUNLOCK(&V_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);
|
||||
@ -2033,15 +2033,15 @@ icmp6_rip6_input(struct mbuf **mp, int off)
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
@ -394,9 +394,9 @@ in6_pcbconnect(register struct inpcb *inp, struct sockaddr *nam,
|
||||
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);
|
||||
@ -414,7 +414,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);
|
||||
}
|
||||
|
||||
@ -617,7 +617,7 @@ in6_pcbnotify(struct inpcbinfo *pcbinfo, struct sockaddr *dst,
|
||||
*/
|
||||
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,
|
||||
@ -736,7 +736,7 @@ in6_pcblookup_local(struct inpcbinfo *pcbinfo, struct in6_addr *laddr,
|
||||
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;
|
||||
|
||||
|
@ -785,7 +785,7 @@ in6_selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
|
||||
* 3. The system default hoplimit.
|
||||
*/
|
||||
int
|
||||
in6_selecthlim(struct in6pcb *in6p, struct ifnet *ifp)
|
||||
in6_selecthlim(struct inpcb *in6p, struct ifnet *ifp)
|
||||
{
|
||||
INIT_VNET_INET6(curvnet);
|
||||
|
||||
|
@ -1225,7 +1225,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
|
||||
if (v4only)
|
||||
return;
|
||||
|
||||
if ((in6p->in6p_flags & IN6P_TCLASS) != 0) {
|
||||
if ((in6p->inp_flags & IN6P_TCLASS) != 0) {
|
||||
u_int32_t flowinfo;
|
||||
int tclass;
|
||||
|
||||
@ -1246,7 +1246,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
|
||||
* 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
|
||||
@ -1298,7 +1298,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
/*
|
||||
@ -1359,7 +1359,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
|
||||
|
||||
switch (nxt) {
|
||||
case IPPROTO_DSTOPTS:
|
||||
if (!(in6p->in6p_flags & IN6P_DSTOPTS))
|
||||
if (!(in6p->inp_flags & IN6P_DSTOPTS))
|
||||
break;
|
||||
|
||||
*mp = sbcreatecontrol((caddr_t)ip6e, elen,
|
||||
@ -1370,7 +1370,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
|
||||
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,
|
||||
|
@ -1464,7 +1464,7 @@ ip6_ctloutput(struct socket *so, struct sockopt *sopt)
|
||||
else {
|
||||
/* -1 = kernel default */
|
||||
in6p->in6p_hops = optval;
|
||||
if ((in6p->in6p_vflag &
|
||||
if ((in6p->inp_vflag &
|
||||
INP_IPV4) != 0)
|
||||
in6p->inp_ip_ttl = optval;
|
||||
}
|
||||
@ -1472,19 +1472,19 @@ ip6_ctloutput(struct socket *so, struct sockopt *sopt)
|
||||
#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 */
|
||||
@ -1578,16 +1578,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 */
|
||||
@ -1768,18 +1768,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:
|
||||
@ -1891,7 +1891,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)
|
||||
@ -2050,7 +2050,7 @@ ip6_raw_ctloutput(struct socket *so, struct sockopt *sopt)
|
||||
{
|
||||
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;
|
||||
@ -3326,7 +3326,7 @@ ip6_splithdr(struct mbuf *m, struct ip6_exthdrs *exthdrs)
|
||||
* Compute IPv6 extension header length.
|
||||
*/
|
||||
int
|
||||
ip6_optlen(struct in6pcb *in6p)
|
||||
ip6_optlen(struct inpcb *in6p)
|
||||
{
|
||||
int len;
|
||||
|
||||
|
@ -168,10 +168,10 @@ rip6_input(struct mbuf **mp, int *offp, int proto)
|
||||
INP_INFO_RLOCK(&V_ripcbinfo);
|
||||
LIST_FOREACH(in6p, &V_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))
|
||||
@ -207,12 +207,12 @@ rip6_input(struct mbuf **mp, int *offp, int proto)
|
||||
} 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);
|
||||
@ -220,7 +220,7 @@ rip6_input(struct mbuf **mp, int *offp, int proto)
|
||||
m_freem(opts);
|
||||
V_rip6stat.rip6s_fullsock++;
|
||||
} else
|
||||
sorwakeup(last->in6p_socket);
|
||||
sorwakeup(last->inp_socket);
|
||||
opts = NULL;
|
||||
}
|
||||
INP_RUNLOCK(last);
|
||||
@ -241,19 +241,19 @@ rip6_input(struct mbuf **mp, int *offp, int proto)
|
||||
} 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);
|
||||
V_rip6stat.rip6s_fullsock++;
|
||||
} else
|
||||
sorwakeup(last->in6p_socket);
|
||||
sorwakeup(last->inp_socket);
|
||||
INP_RUNLOCK(last);
|
||||
} else {
|
||||
V_rip6stat.rip6s_nosock++;
|
||||
@ -353,7 +353,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;
|
||||
@ -437,14 +437,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 ||
|
||||
@ -595,7 +595,7 @@ rip6_attach(struct socket *so, int proto, struct thread *td)
|
||||
inp = (struct inpcb *)so->so_pcb;
|
||||
INP_INFO_WUNLOCK(&V_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;
|
||||
|
@ -153,7 +153,7 @@ udp6_append(struct inpcb *inp, struct mbuf *n, int off,
|
||||
}
|
||||
#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));
|
||||
@ -259,7 +259,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
|
||||
LIST_FOREACH(inp, &V_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
|
||||
@ -278,7 +278,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -562,7 +562,7 @@ udp6_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr6,
|
||||
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,
|
||||
@ -606,7 +606,7 @@ udp6_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr6,
|
||||
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 {
|
||||
@ -615,7 +615,7 @@ udp6_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr6,
|
||||
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
|
||||
@ -632,7 +632,7 @@ udp6_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr6,
|
||||
}
|
||||
laddr = &inp->in6p_laddr;
|
||||
faddr = &inp->in6p_faddr;
|
||||
fport = inp->in6p_fport;
|
||||
fport = inp->inp_fport;
|
||||
}
|
||||
|
||||
if (af == AF_INET)
|
||||
@ -652,7 +652,7 @@ udp6_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr6,
|
||||
* 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);
|
||||
@ -663,7 +663,7 @@ udp6_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr6,
|
||||
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. */
|
||||
|
@ -230,7 +230,7 @@ SYSCTL_V_STRUCT(V_NET, vnet_ipsec, _net_inet6_ipsec6, IPSECCTL_STATS,
|
||||
|
||||
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));
|
||||
@ -376,7 +376,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
|
||||
@ -578,27 +578,27 @@ ipsec4_setspidx_inpcb(m, pcb)
|
||||
static int
|
||||
ipsec6_setspidx_in6pcb(m, pcb)
|
||||
struct mbuf *m;
|
||||
struct in6pcb *pcb;
|
||||
struct inpcb *pcb;
|
||||
{
|
||||
//INIT_VNET_IPSEC(curvnet);
|
||||
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;
|
||||
@ -607,8 +607,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
|
||||
@ -1245,7 +1245,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;
|
||||
@ -1265,10 +1265,10 @@ ipsec6_set_policy(in6p, optname, request, len, cred)
|
||||
/* 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__,
|
||||
@ -1281,7 +1281,7 @@ ipsec6_set_policy(in6p, optname, request, len, cred)
|
||||
|
||||
int
|
||||
ipsec6_get_policy(in6p, request, len, mp)
|
||||
struct in6pcb *in6p;
|
||||
struct inpcb *in6p;
|
||||
caddr_t request;
|
||||
size_t len;
|
||||
struct mbuf **mp;
|
||||
@ -1293,7 +1293,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;
|
||||
@ -1301,10 +1301,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__,
|
||||
@ -1684,7 +1684,7 @@ size_t
|
||||
ipsec6_hdrsiz(m, dir, in6p)
|
||||
struct mbuf *m;
|
||||
u_int dir;
|
||||
struct in6pcb *in6p;
|
||||
struct inpcb *in6p;
|
||||
{
|
||||
INIT_VNET_IPSEC(curvnet);
|
||||
struct secpolicy *sp;
|
||||
@ -1692,7 +1692,7 @@ ipsec6_hdrsiz(m, dir, in6p)
|
||||
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 */
|
||||
|
@ -1160,8 +1160,13 @@ 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:
|
||||
#endif
|
||||
#ifdef INET6
|
||||
case PF_INET6:
|
||||
#endif
|
||||
{
|
||||
struct inpcb *pcb = sotoinpcb(so);
|
||||
|
||||
@ -1172,30 +1177,7 @@ key_freeso(struct socket *so)
|
||||
key_freesp_so(&pcb->inp_sp->sp_out);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef INET6
|
||||
case PF_INET6:
|
||||
{
|
||||
#ifdef HAVE_NRL_INPCB
|
||||
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));
|
||||
|
Loading…
Reference in New Issue
Block a user