| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ip_encap.c,v 1.41 2015/04/15 03:38:50 ozaki-r Exp $ */ | | 1 | /* $NetBSD: ip_encap.c,v 1.42 2015/04/15 08:47:28 ozaki-r Exp $ */ |
2 | /* $KAME: ip_encap.c,v 1.73 2001/10/02 08:30:58 itojun Exp $ */ | | 2 | /* $KAME: ip_encap.c,v 1.73 2001/10/02 08:30:58 itojun 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 |
| @@ -65,27 +65,27 @@ | | | @@ -65,27 +65,27 @@ |
65 | * The code assumes that radix table code can handle non-continuous netmask, | | 65 | * The code assumes that radix table code can handle non-continuous netmask, |
66 | * as it will pass radix table memory region with (src + dst) sockaddr pair. | | 66 | * as it will pass radix table memory region with (src + dst) sockaddr pair. |
67 | * | | 67 | * |
68 | * FreeBSD is excluded here as they make max_keylen a static variable, and | | 68 | * FreeBSD is excluded here as they make max_keylen a static variable, and |
69 | * thus forbid definition of radix table other than proper domains. | | 69 | * thus forbid definition of radix table other than proper domains. |
70 | * | | 70 | * |
71 | * !!!!!!! | | 71 | * !!!!!!! |
72 | * !!NOTE: dom_maxrtkey assumes USE_RADIX is defined. | | 72 | * !!NOTE: dom_maxrtkey assumes USE_RADIX is defined. |
73 | * !!!!!!! | | 73 | * !!!!!!! |
74 | */ | | 74 | */ |
75 | #define USE_RADIX | | 75 | #define USE_RADIX |
76 | | | 76 | |
77 | #include <sys/cdefs.h> | | 77 | #include <sys/cdefs.h> |
78 | __KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.41 2015/04/15 03:38:50 ozaki-r Exp $"); | | 78 | __KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.42 2015/04/15 08:47:28 ozaki-r Exp $"); |
79 | | | 79 | |
80 | #include "opt_mrouting.h" | | 80 | #include "opt_mrouting.h" |
81 | #include "opt_inet.h" | | 81 | #include "opt_inet.h" |
82 | | | 82 | |
83 | #include <sys/param.h> | | 83 | #include <sys/param.h> |
84 | #include <sys/systm.h> | | 84 | #include <sys/systm.h> |
85 | #include <sys/socket.h> | | 85 | #include <sys/socket.h> |
86 | #include <sys/sockio.h> | | 86 | #include <sys/sockio.h> |
87 | #include <sys/mbuf.h> | | 87 | #include <sys/mbuf.h> |
88 | #include <sys/errno.h> | | 88 | #include <sys/errno.h> |
89 | #include <sys/protosw.h> | | 89 | #include <sys/protosw.h> |
90 | #include <sys/queue.h> | | 90 | #include <sys/queue.h> |
91 | | | 91 | |
| @@ -725,30 +725,30 @@ encap6_ctlinput(int cmd, const struct so | | | @@ -725,30 +725,30 @@ encap6_ctlinput(int cmd, const struct so |
725 | if (psw && psw->pr_ctlinput) | | 725 | if (psw && psw->pr_ctlinput) |
726 | (*psw->pr_ctlinput)(cmd, sa, d); | | 726 | (*psw->pr_ctlinput)(cmd, sa, d); |
727 | } | | 727 | } |
728 | | | 728 | |
729 | rip6_ctlinput(cmd, sa, d0); | | 729 | rip6_ctlinput(cmd, sa, d0); |
730 | return NULL; | | 730 | return NULL; |
731 | } | | 731 | } |
732 | #endif | | 732 | #endif |
733 | | | 733 | |
734 | int | | 734 | int |
735 | encap_detach(const struct encaptab *cookie) | | 735 | encap_detach(const struct encaptab *cookie) |
736 | { | | 736 | { |
737 | const struct encaptab *ep = cookie; | | 737 | const struct encaptab *ep = cookie; |
738 | struct encaptab *p; | | 738 | struct encaptab *p, *np; |
739 | int error; | | 739 | int error; |
740 | | | 740 | |
741 | LIST_FOREACH(p, &encaptab, chain) { | | 741 | LIST_FOREACH_SAFE(p, &encaptab, chain, np) { |
742 | if (p == ep) { | | 742 | if (p == ep) { |
743 | error = encap_remove(p); | | 743 | error = encap_remove(p); |
744 | if (error) | | 744 | if (error) |
745 | return error; | | 745 | return error; |
746 | if (!ep->func) { | | 746 | if (!ep->func) { |
747 | free(p->addrpack, M_NETADDR); | | 747 | free(p->addrpack, M_NETADDR); |
748 | free(p->maskpack, M_NETADDR); | | 748 | free(p->maskpack, M_NETADDR); |
749 | } | | 749 | } |
750 | free(p, M_NETADDR); /*XXX*/ | | 750 | free(p, M_NETADDR); /*XXX*/ |
751 | return 0; | | 751 | return 0; |
752 | } | | 752 | } |
753 | } | | 753 | } |
754 | | | 754 | |