Since we fail IPv6 raw socket allocation if inp->in6p_icmp6filt can't

be allocated, there's no need to conditionize use and freeing of it
later.

MFC after:	1 week
This commit is contained in:
Robert Watson 2008-07-29 18:09:46 +00:00
parent 9b501d5ab1
commit 2f1ff0cd80
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=180965
2 changed files with 3 additions and 15 deletions

View file

@ -1908,9 +1908,8 @@ icmp6_rip6_input(struct mbuf **mp, int off)
!IN6_ARE_ADDR_EQUAL(&in6p->in6p_faddr, &ip6->ip6_src))
continue;
INP_RLOCK(in6p);
if (in6p->in6p_icmp6filt
&& ICMP6_FILTER_WILLBLOCK(icmp6->icmp6_type,
in6p->in6p_icmp6filt)) {
if (ICMP6_FILTER_WILLBLOCK(icmp6->icmp6_type,
in6p->in6p_icmp6filt)) {
INP_RUNLOCK(in6p);
continue;
}
@ -2722,10 +2721,6 @@ icmp6_ctloutput(struct socket *so, struct sockopt *sopt)
error = EMSGSIZE;
break;
}
if (inp->in6p_icmp6filt == NULL) {
error = EINVAL;
break;
}
error = sooptcopyin(sopt, inp->in6p_icmp6filt, optlen,
optlen);
break;
@ -2741,10 +2736,6 @@ icmp6_ctloutput(struct socket *so, struct sockopt *sopt)
switch (optname) {
case ICMP6_FILTER:
{
if (inp->in6p_icmp6filt == NULL) {
error = EINVAL;
break;
}
error = sooptcopyout(sopt, inp->in6p_icmp6filt,
sizeof(struct icmp6_filter));
break;

View file

@ -592,10 +592,7 @@ rip6_detach(struct socket *so)
/* xxx: RSVP */
INP_INFO_WLOCK(&ripcbinfo);
INP_WLOCK(inp);
if (inp->in6p_icmp6filt) {
FREE(inp->in6p_icmp6filt, M_PCB);
inp->in6p_icmp6filt = NULL;
}
FREE(inp->in6p_icmp6filt, M_PCB);
in6_pcbdetach(inp);
in6_pcbfree(inp);
INP_INFO_WUNLOCK(&ripcbinfo);