Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

check for pktinfo needcopy/needfree inconsistency.

maybe we should just remove the 2nd arg of ip6_clearpktopts().

(inconsistency do seem to happen - try "ping6 ::1 ::1 ::1" on freebsd2)
  • Loading branch information...
commit e1b44633bd4953204100aa3e3a8c26f27e369930 1 parent e814512
itojun authored
Showing with 17 additions and 2 deletions.
  1. +14 −1 kame/sys/netinet6/ip6_output.c
  2. +3 −1 kame/sys/netinet6/ip6_var.h
View
15 kame/sys/netinet6/ip6_output.c
@@ -1,4 +1,4 @@
-/* $KAME: ip6_output.c,v 1.122 2000/08/19 02:12:02 jinmei Exp $ */
+/* $KAME: ip6_output.c,v 1.123 2000/08/20 04:44:19 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -2612,6 +2612,17 @@ ip6_clearpktopts(pktopt, needfree, optname)
if (pktopt == NULL)
return;
+#ifdef DIAGNOSTIC
+ if ((needfree && !pktopt->needfree) ||
+ (!needfree && pktopt->needfree)) {
+#if 0
+ panic("needfree inconsistent");
+#else
+ printf("needfree inconsistent: %p %d %d\n", pktopt, needfree,
+ pktopt->needfree);
+#endif
+ }
+#endif
if (optname == -1 || optname == IPV6_PKTINFO) {
if (needfree && pktopt->ip6po_pktinfo)
free(pktopt->ip6po_pktinfo, M_IP6OPT);
@@ -2675,6 +2686,7 @@ ip6_copypktopts(src, canwait)
if (dst == NULL && canwait == M_NOWAIT)
goto bad;
bzero(dst, sizeof(*dst));
+ dst->needfree = 1;
dst->ip6po_hlim = src->ip6po_hlim;
dst->ip6po_flags = src->ip6po_flags;
@@ -3124,6 +3136,7 @@ ip6_setpktoptions(control, opt, priv, needcopy)
bzero(opt, sizeof(*opt));
opt->ip6po_hlim = -1; /* -1 means to use default hop limit */
+ opt->needfree = needcopy;
/*
* XXX: Currently, we assume all the optional information is stored
View
4 kame/sys/netinet6/ip6_var.h
@@ -1,4 +1,4 @@
-/* $KAME: ip6_var.h,v 1.40 2000/08/17 01:08:40 itojun Exp $ */
+/* $KAME: ip6_var.h,v 1.41 2000/08/20 04:44:19 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -152,6 +152,8 @@ struct ip6_pktopts {
int ip6po_flags;
#define IP6PO_REACHCONF 0x01 /* upper-layer reachability confirmation */
#define IP6PO_MINMTU 0x02 /* use minimum MTU (IPV6_USE_MIN_MTU) */
+
+ int needfree; /* members dynamically allocated */
};
/*
Please sign in to comment.
Something went wrong with that request. Please try again.