Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys on interface removal, remove multicast groups joined fro...
details: https://anonhg.NetBSD.org/src/rev/2f85f51f8b33
branches: trunk
changeset: 512001:2f85f51f8b33
user: itojun <itojun%NetBSD.org@localhost>
date: Mon Jul 02 15:25:34 2001 +0000
description:
on interface removal, remove multicast groups joined from pcb, before
removing interface addresses. without the change, we may deref
NULL pointer in in_pcbpurgeif(). from jinmei@kame, sync with kame
diffstat:
sys/netinet/in_pcb.c | 24 +++++++++++++++++++-----
sys/netinet/in_pcb.h | 3 ++-
sys/netinet6/in6_pcb.c | 22 +++++++++++++++++-----
sys/netinet6/in6_pcb.h | 3 ++-
4 files changed, 40 insertions(+), 12 deletions(-)
diffs (136 lines):
diff -r 13da28beb95d -r 2f85f51f8b33 sys/netinet/in_pcb.c
--- a/sys/netinet/in_pcb.c Mon Jul 02 14:50:40 2001 +0000
+++ b/sys/netinet/in_pcb.c Mon Jul 02 15:25:34 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in_pcb.c,v 1.68 2000/11/08 14:28:14 ad Exp $ */
+/* $NetBSD: in_pcb.c,v 1.69 2001/07/02 15:25:34 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -623,7 +623,7 @@
}
void
-in_pcbpurgeif(table, ifp)
+in_pcbpurgeif0(table, ifp)
struct inpcbtable *table;
struct ifnet *ifp;
{
@@ -635,9 +635,6 @@
inp != (struct inpcb *)&table->inpt_queue;
inp = ninp) {
ninp = inp->inp_queue.cqe_next;
- if (inp->inp_route.ro_rt != NULL &&
- inp->inp_route.ro_rt->rt_ifp == ifp)
- in_rtchange(inp, 0);
imo = inp->inp_moptions;
if (imo != NULL) {
/*
@@ -665,6 +662,23 @@
}
}
+void
+in_pcbpurgeif(table, ifp)
+ struct inpcbtable *table;
+ struct ifnet *ifp;
+{
+ struct inpcb *inp, *ninp;
+
+ for (inp = table->inpt_queue.cqh_first;
+ inp != (struct inpcb *)&table->inpt_queue;
+ inp = ninp) {
+ ninp = inp->inp_queue.cqe_next;
+ if (inp->inp_route.ro_rt != NULL &&
+ inp->inp_route.ro_rt->rt_ifp == ifp)
+ in_rtchange(inp, 0);
+ }
+}
+
/*
* Check for alternatives when higher level complains
* about service problems. For now, invalidate cached
diff -r 13da28beb95d -r 2f85f51f8b33 sys/netinet/in_pcb.h
--- a/sys/netinet/in_pcb.h Mon Jul 02 14:50:40 2001 +0000
+++ b/sys/netinet/in_pcb.h Mon Jul 02 15:25:34 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in_pcb.h,v 1.29 2000/02/02 23:28:09 thorpej Exp $ */
+/* $NetBSD: in_pcb.h,v 1.30 2001/07/02 15:25:35 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -151,6 +151,7 @@
struct in_addr, u_int, int, void (*)(struct inpcb *, int)));
void in_pcbnotifyall __P((struct inpcbtable *, struct in_addr, int,
void (*)(struct inpcb *, int)));
+void in_pcbpurgeif0 __P((struct inpcbtable *, struct ifnet *));
void in_pcbpurgeif __P((struct inpcbtable *, struct ifnet *));
void in_pcbstate __P((struct inpcb *, int));
void in_rtchange __P((struct inpcb *, int));
diff -r 13da28beb95d -r 2f85f51f8b33 sys/netinet6/in6_pcb.c
--- a/sys/netinet6/in6_pcb.c Mon Jul 02 14:50:40 2001 +0000
+++ b/sys/netinet6/in6_pcb.c Mon Jul 02 15:25:34 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_pcb.c,v 1.37 2001/06/27 15:53:14 itojun Exp $ */
+/* $NetBSD: in6_pcb.c,v 1.38 2001/07/02 15:25:35 itojun Exp $ */
/* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */
/*
@@ -603,7 +603,7 @@
}
void
-in6_pcbpurgeif(head, ifp)
+in6_pcbpurgeif0(head, ifp)
struct in6pcb *head;
struct ifnet *ifp;
{
@@ -613,9 +613,6 @@
for (in6p = head->in6p_next; in6p != head; in6p = nin6p) {
nin6p = in6p->in6p_next;
- if (in6p->in6p_route.ro_rt != NULL &&
- in6p->in6p_route.ro_rt->rt_ifp == ifp)
- in6_rtchange(in6p, 0);
im6o = in6p->in6p_moptions;
if (im6o) {
/*
@@ -644,6 +641,21 @@
}
}
+void
+in6_pcbpurgeif(head, ifp)
+ struct in6pcb *head;
+ struct ifnet *ifp;
+{
+ struct in6pcb *in6p, *nin6p;
+
+ for (in6p = head->in6p_next; in6p != head; in6p = nin6p) {
+ nin6p = in6p->in6p_next;
+ if (in6p->in6p_route.ro_rt != NULL &&
+ in6p->in6p_route.ro_rt->rt_ifp == ifp)
+ in6_rtchange(in6p, 0);
+ }
+}
+
/*
* Check for alternatives when higher level complains
* about service problems. For now, invalidate cached
diff -r 13da28beb95d -r 2f85f51f8b33 sys/netinet6/in6_pcb.h
--- a/sys/netinet6/in6_pcb.h Mon Jul 02 14:50:40 2001 +0000
+++ b/sys/netinet6/in6_pcb.h Mon Jul 02 15:25:34 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_pcb.h,v 1.16 2001/02/11 06:50:59 itojun Exp $ */
+/* $NetBSD: in6_pcb.h,v 1.17 2001/07/02 15:25:36 itojun Exp $ */
/* $KAME: in6_pcb.h,v 1.45 2001/02/09 05:59:46 itojun Exp $ */
/*
@@ -166,6 +166,7 @@
int in6_pcbnotify __P((struct in6pcb *, struct sockaddr *,
u_int, struct sockaddr *, u_int, int, void *,
void (*)(struct in6pcb *, int)));
+void in6_pcbpurgeif0 __P((struct in6pcb *, struct ifnet *));
void in6_pcbpurgeif __P((struct in6pcb *, struct ifnet *));
void in6_rtchange __P((struct in6pcb *, int));
void in6_setpeeraddr __P((struct in6pcb *, struct mbuf *));
Home |
Main Index |
Thread Index |
Old Index