Sun Oct 6 02:30:58 2019 UTC ()
icmp6_notify_error - fix ctlfunc typedef to match pr_ctlinput,
drop the cast that is no longer necessary.


(uwe)
diff -r1.242 -r1.243 src/sys/netinet6/icmp6.c

cvs diff -r1.242 -r1.243 src/sys/netinet6/icmp6.c (expand / switch to unified diff)

--- src/sys/netinet6/icmp6.c 2018/12/22 14:07:54 1.242
+++ src/sys/netinet6/icmp6.c 2019/10/06 02:30:58 1.243
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: icmp6.c,v 1.242 2018/12/22 14:07:54 maxv Exp $ */ 1/* $NetBSD: icmp6.c,v 1.243 2019/10/06 02:30:58 uwe Exp $ */
2/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ 2/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
3 3
4/* 4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -52,27 +52,27 @@ @@ -52,27 +52,27 @@
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE. 59 * SUCH DAMAGE.
60 * 60 *
61 * @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94 61 * @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94
62 */ 62 */
63 63
64#include <sys/cdefs.h> 64#include <sys/cdefs.h>
65__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.242 2018/12/22 14:07:54 maxv Exp $"); 65__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.243 2019/10/06 02:30:58 uwe Exp $");
66 66
67#ifdef _KERNEL_OPT 67#ifdef _KERNEL_OPT
68#include "opt_inet.h" 68#include "opt_inet.h"
69#include "opt_ipsec.h" 69#include "opt_ipsec.h"
70#endif 70#endif
71 71
72#include <sys/param.h> 72#include <sys/param.h>
73#include <sys/systm.h> 73#include <sys/systm.h>
74#include <sys/kmem.h> 74#include <sys/kmem.h>
75#include <sys/mbuf.h> 75#include <sys/mbuf.h>
76#include <sys/protosw.h> 76#include <sys/protosw.h>
77#include <sys/socket.h> 77#include <sys/socket.h>
78#include <sys/socketvar.h> 78#include <sys/socketvar.h>
@@ -940,27 +940,27 @@ icmp6_notify_error(struct mbuf *m, int o @@ -940,27 +940,27 @@ icmp6_notify_error(struct mbuf *m, int o
940 ICMP6_STATINC(ICMP6_STAT_TOOSHORT); 940 ICMP6_STATINC(ICMP6_STAT_TOOSHORT);
941 goto freeit; 941 goto freeit;
942 } 942 }
943 IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, 943 IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off,
944 sizeof(*icmp6) + sizeof(struct ip6_hdr)); 944 sizeof(*icmp6) + sizeof(struct ip6_hdr));
945 if (icmp6 == NULL) { 945 if (icmp6 == NULL) {
946 ICMP6_STATINC(ICMP6_STAT_TOOSHORT); 946 ICMP6_STATINC(ICMP6_STAT_TOOSHORT);
947 return (-1); 947 return (-1);
948 } 948 }
949 eip6 = (struct ip6_hdr *)(icmp6 + 1); 949 eip6 = (struct ip6_hdr *)(icmp6 + 1);
950 950
951 /* Detect the upper level protocol */ 951 /* Detect the upper level protocol */
952 { 952 {
953 void (*ctlfunc)(int, struct sockaddr *, void *); 953 void *(*ctlfunc)(int, const struct sockaddr *, void *);
954 u_int8_t nxt = eip6->ip6_nxt; 954 u_int8_t nxt = eip6->ip6_nxt;
955 int eoff = off + sizeof(struct icmp6_hdr) + 955 int eoff = off + sizeof(struct icmp6_hdr) +
956 sizeof(struct ip6_hdr); 956 sizeof(struct ip6_hdr);
957 struct ip6ctlparam ip6cp; 957 struct ip6ctlparam ip6cp;
958 struct in6_addr *finaldst = NULL; 958 struct in6_addr *finaldst = NULL;
959 int icmp6type = icmp6->icmp6_type; 959 int icmp6type = icmp6->icmp6_type;
960 struct ip6_frag *fh; 960 struct ip6_frag *fh;
961 struct ip6_rthdr *rth; 961 struct ip6_rthdr *rth;
962 struct ifnet *rcvif; 962 struct ifnet *rcvif;
963 int s; 963 int s;
964 964
965 while (1) { /* XXX: should avoid infinite loop explicitly? */ 965 while (1) { /* XXX: should avoid infinite loop explicitly? */
966 struct ip6_ext *eh; 966 struct ip6_ext *eh;
@@ -1067,28 +1067,27 @@ icmp6_notify_error(struct mbuf *m, int o @@ -1067,28 +1067,27 @@ icmp6_notify_error(struct mbuf *m, int o
1067 ip6cp.ip6c_m = m; 1067 ip6cp.ip6c_m = m;
1068 ip6cp.ip6c_icmp6 = icmp6; 1068 ip6cp.ip6c_icmp6 = icmp6;
1069 ip6cp.ip6c_ip6 = (struct ip6_hdr *)(icmp6 + 1); 1069 ip6cp.ip6c_ip6 = (struct ip6_hdr *)(icmp6 + 1);
1070 ip6cp.ip6c_off = eoff; 1070 ip6cp.ip6c_off = eoff;
1071 ip6cp.ip6c_finaldst = finaldst; 1071 ip6cp.ip6c_finaldst = finaldst;
1072 ip6cp.ip6c_src = &icmp6src; 1072 ip6cp.ip6c_src = &icmp6src;
1073 ip6cp.ip6c_nxt = nxt; 1073 ip6cp.ip6c_nxt = nxt;
1074 1074
1075 if (icmp6type == ICMP6_PACKET_TOO_BIG) { 1075 if (icmp6type == ICMP6_PACKET_TOO_BIG) {
1076 notifymtu = ntohl(icmp6->icmp6_mtu); 1076 notifymtu = ntohl(icmp6->icmp6_mtu);
1077 ip6cp.ip6c_cmdarg = (void *)&notifymtu; 1077 ip6cp.ip6c_cmdarg = (void *)&notifymtu;
1078 } 1078 }
1079 1079
1080 ctlfunc = (void (*)(int, struct sockaddr *, void *)) 1080 ctlfunc = inet6sw[ip6_protox[nxt]].pr_ctlinput;
1081 (inet6sw[ip6_protox[nxt]].pr_ctlinput); 
1082 if (ctlfunc) { 1081 if (ctlfunc) {
1083 (void)(*ctlfunc)(code, sin6tosa(&icmp6dst), &ip6cp); 1082 (void)(*ctlfunc)(code, sin6tosa(&icmp6dst), &ip6cp);
1084 } 1083 }
1085 } 1084 }
1086 return (0); 1085 return (0);
1087 1086
1088freeit: 1087freeit:
1089 m_freem(m); 1088 m_freem(m);
1090 return (-1); 1089 return (-1);
1091} 1090}
1092 1091
1093void 1092void
1094icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int validated) 1093icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int validated)