- struct inpcb *inp;
- int error;
-
- inp = sotoinpcb(so);
- if (inp)
- panic("icmp6_dgram_attach");
-
- if (proto != IPPROTO_ICMPV6)
- return EINVAL;
-
- error = soreserve(so, rip_sendspace, rip_recvspace);
- if (error)
- return error;
- error = in_pcballoc(so, &ripcbinfo, p);
- if (error)
- return error;
- inp = (struct inpcb *)so->so_pcb;
- inp->inp_vflag |= INP_IPV6;
- inp->in6p_ip6_nxt = IPPROTO_ICMPV6;
- inp->in6p_hops = -1; /* use kernel default */
- inp->in6p_cksum = -1;
- MALLOC(inp->in6p_icmp6filt, struct icmp6_filter *,
- sizeof(struct icmp6_filter), M_PCB, M_WAITOK);
- if (inp->in6p_icmp6filt == NULL)
- return (ENOMEM);
- ICMP6_FILTER_SETPASSALL(inp->in6p_icmp6filt);
- return 0;
+ struct inpcb *inp;
+ int error;
+
+ inp = sotoinpcb(so);
+ if (inp) {
+ panic("icmp6_dgram_attach");
+ }
+
+ if (proto != IPPROTO_ICMPV6) {
+ return EINVAL;
+ }
+
+ error = soreserve(so, rip_sendspace, rip_recvspace);
+ if (error) {
+ return error;
+ }
+ error = in_pcballoc(so, &ripcbinfo, p);
+ if (error) {
+ return error;
+ }
+ inp = (struct inpcb *)so->so_pcb;
+ inp->inp_vflag |= INP_IPV6;
+ inp->in6p_ip6_nxt = IPPROTO_ICMPV6;
+ inp->in6p_hops = -1; /* use kernel default */
+ inp->in6p_cksum = -1;
+ MALLOC(inp->in6p_icmp6filt, struct icmp6_filter *,
+ sizeof(struct icmp6_filter), M_PCB, M_WAITOK);
+ if (inp->in6p_icmp6filt == NULL) {
+ return ENOMEM;
+ }
+ ICMP6_FILTER_SETPASSALL(inp->in6p_icmp6filt);
+ return 0;