Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

mofidied some mipsock notify functions to AF independent.

  • Loading branch information...
commit d5bcfa728090ded9a03b3cb9bdc9f992449da2d0 1 parent c14f644
keiichi authored
View
63 kame/sys/net/mipsock.c
@@ -1,4 +1,4 @@
-/* $Id: mipsock.c,v 1.11 2005/04/14 06:22:38 suz Exp $ */
+/* $Id: mipsock.c,v 1.12 2005/06/09 02:16:10 keiichi Exp $ */
/*
* Copyright (C) 2004 WIDE Project.
@@ -638,29 +638,23 @@ mips_notify_bul(type, mbul)
void
mips_notify_home_hint(ifindex, prefix, prefixlen)
u_int16_t ifindex;
- struct in6_addr *prefix;
+ struct sockaddr *prefix;
u_int16_t prefixlen;
{
struct mipm_home_hint *hint;
- struct sockaddr_in6 sin6;
struct mbuf *m;
- int len = sizeof(struct mipm_home_hint) + sizeof(struct sockaddr_in6);
+ int len = sizeof(struct mipm_home_hint) + prefix->sa_len;
m = mips_msg1(MIPM_HOME_HINT, len);
if (m == NULL)
return;
- bzero(&sin6, sizeof(sin6));
- sin6.sin6_len = sizeof(struct sockaddr_in6);
- sin6.sin6_family = AF_INET6;
- sin6.sin6_addr = *prefix;
-
hint = mtod(m, struct mipm_home_hint *);
hint->mipmhh_seq = 0;
hint->mipmhh_ifindex = ifindex;
hint->mipmhh_prefixlen = prefixlen;
- bcopy(&sin6, (char *) hint->mipmhh_prefix, sizeof(sin6));
+ bcopy(prefix, (char *) hint->mipmhh_prefix, prefix->sa_len);
raw_input(m, &mips_proto, &mips_src, &mips_dst);
}
@@ -671,14 +665,13 @@ mips_notify_home_hint(ifindex, prefix, prefixlen)
*/
void
mips_notify_rr_hint(hoa, peeraddr)
- struct in6_addr *hoa;
- struct in6_addr *peeraddr;
+ struct sockaddr *hoa;
+ struct sockaddr *peeraddr;
{
struct mipm_rr_hint *rr_hint;
- struct sockaddr_in6 sin6;
struct mbuf *m;
u_short len = sizeof(struct mipm_rr_hint)
- + (2 * sizeof(struct sockaddr_in6));
+ + hoa->sa_len + peeraddr->sa_len;
m = mips_msg1(MIPM_RR_HINT, len);
if (m == NULL)
@@ -686,17 +679,8 @@ mips_notify_rr_hint(hoa, peeraddr)
rr_hint = mtod(m, struct mipm_rr_hint *);
rr_hint->mipmrh_seq = 0;
- bzero(&sin6, sizeof(sin6));
- sin6.sin6_len = sizeof(struct sockaddr_in6);
- sin6.sin6_family = AF_INET6;
- sin6.sin6_addr = *hoa;
- bcopy(&sin6, (void *)MIPMRH_HOA(rr_hint), sizeof(sin6));
-
- bzero(&sin6, sizeof(sin6));
- sin6.sin6_len = sizeof(struct sockaddr_in6);
- sin6.sin6_family = AF_INET6;
- sin6.sin6_addr = *peeraddr;
- bcopy(&sin6, (void *)MIPMRH_PEERADDR(rr_hint), sizeof(sin6));
+ bcopy(hoa, (void *)MIPMRH_HOA(rr_hint), hoa->sa_len);
+ bcopy(peeraddr, (void *)MIPMRH_PEERADDR(rr_hint), peeraddr->sa_len);
raw_input(m, &mips_proto, &mips_src, &mips_dst);
}
@@ -707,16 +691,15 @@ mips_notify_rr_hint(hoa, peeraddr)
*/
void
mips_notify_be_hint(src, coa, hoa, status)
- struct in6_addr *src;
- struct in6_addr *coa;
- struct in6_addr *hoa;
+ struct sockaddr *src;
+ struct sockaddr *coa;
+ struct sockaddr *hoa;
u_int8_t status;
{
struct mipm_be_hint *be_hint;
- struct sockaddr_in6 sin6;
struct mbuf *m;
u_short len = sizeof(struct mipm_be_hint)
- + (3 * sizeof(struct sockaddr_in6));
+ + src->sa_len + coa->sa_len + hoa->sa_len;
m = mips_msg1(MIPM_BE_HINT, len);
if (m == NULL)
@@ -726,23 +709,9 @@ mips_notify_be_hint(src, coa, hoa, status)
be_hint->mipmbeh_status = status;
- bzero(&sin6, sizeof(sin6));
- sin6.sin6_len = sizeof(struct sockaddr_in6);
- sin6.sin6_family = AF_INET6;
- sin6.sin6_addr = *src;
- bcopy(&sin6, (void *)MIPMBEH_PEERADDR(be_hint), sizeof(sin6));
-
- bzero(&sin6, sizeof(sin6));
- sin6.sin6_len = sizeof(struct sockaddr_in6);
- sin6.sin6_family = AF_INET6;
- sin6.sin6_addr = *coa;
- bcopy(&sin6, (void *)MIPMBEH_COA(be_hint), sizeof(sin6));
-
- bzero(&sin6, sizeof(sin6));
- sin6.sin6_len = sizeof(struct sockaddr_in6);
- sin6.sin6_family = AF_INET6;
- sin6.sin6_addr = *hoa;
- bcopy(&sin6, (void *)MIPMBEH_HOA(be_hint), sizeof(sin6));
+ bcopy(src, (void *)MIPMBEH_PEERADDR(be_hint), src->sa_len);
+ bcopy(coa, (void *)MIPMBEH_COA(be_hint), coa->sa_len);
+ bcopy(hoa, (void *)MIPMBEH_HOA(be_hint), hoa->sa_len);
raw_input(m, &mips_proto, &mips_src, &mips_dst);
}
View
10 kame/sys/net/mipsock.h
@@ -1,4 +1,4 @@
-/* $Id: mipsock.h,v 1.4 2005/03/10 23:30:36 t-momose Exp $ */
+/* $Id: mipsock.h,v 1.5 2005/06/09 02:16:10 keiichi Exp $ */
/*
* Copyright (C) 2004 WIDE Project.
@@ -197,9 +197,9 @@ struct mipm_be_hint {
int mips_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
struct mbuf *, struct proc *);
#endif
-void mips_notify_home_hint(u_int16_t, struct in6_addr *, u_int16_t);
-void mips_notify_rr_hint(struct in6_addr *, struct in6_addr *);
-void mips_notify_be_hint(struct in6_addr *, struct in6_addr *,
- struct in6_addr *, u_int8_t);
+void mips_notify_home_hint(u_int16_t, struct sockaddr *, u_int16_t);
+void mips_notify_rr_hint(struct sockaddr *, struct sockaddr *);
+void mips_notify_be_hint(struct sockaddr *, struct sockaddr *,
+ struct sockaddr *, u_int8_t);
#endif /* !_NET_MIPSOCK_H_ */
View
44 kame/sys/netinet6/dest6.c
@@ -1,4 +1,4 @@
-/* $KAME: dest6.c,v 1.69 2005/01/20 09:14:05 t-momose Exp $ */
+/* $KAME: dest6.c,v 1.70 2005/06/09 02:16:10 keiichi Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -68,9 +68,11 @@
#include <netinet/ip6mh.h>
#include <netinet6/mip6_var.h>
-static int dest6_swap_hao __P((struct ip6_hdr *, struct ip6aux *,
- struct ip6_opt_home_address *));
-static int dest6_nextopt __P((struct mbuf *, int, struct ip6_opt *));
+static int dest6_swap_hao(struct ip6_hdr *, struct ip6aux *,
+ struct ip6_opt_home_address *);
+static int dest6_nextopt(struct mbuf *, int, struct ip6_opt *);
+static void mip6_notify_be_hint(struct in6_addr *, struct in6_addr *,
+ struct in6_addr *, u_int8_t);
#endif /* MIP6 */
/*
@@ -342,7 +344,7 @@ dest6_mip6_hao(m, mhoff, nxt)
return (0);
}
/* notify to send a binding error by the mobility socket. */
- (void)mips_notify_be_hint(&ip6->ip6_src, &ip6->ip6_dst, &home,
+ (void)mip6_notify_be_hint(&ip6->ip6_src, &ip6->ip6_dst, &home,
IP6_MH_BES_UNKNOWN_HAO);
return (-1);
}
@@ -361,9 +363,39 @@ dest6_mip6_hao(m, mhoff, nxt)
/* mip6stat.mip6s_unverifiedhao++;*/
/* notify to send a binding error by the mobility socket. */
- (void)mips_notify_be_hint(&ip6->ip6_src, &ip6->ip6_dst, &home,
+ (void)mip6_notify_be_hint(&ip6->ip6_src, &ip6->ip6_dst, &home,
IP6_MH_BES_UNKNOWN_HAO);
return (-1);
}
+
+static void
+mip6_notify_be_hint(src, coa, hoa, status)
+ struct in6_addr *src;
+ struct in6_addr *coa;
+ struct in6_addr *hoa;
+ u_int8_t status;
+{
+ struct sockaddr_in6 src_sin6, coa_sin6, hoa_sin6;
+
+ bzero(&src_sin6, sizeof(struct sockaddr_in6));
+ bzero(&coa_sin6, sizeof(struct sockaddr_in6));
+ bzero(&hoa_sin6, sizeof(struct sockaddr_in6));
+
+ src_sin6.sin6_len = sizeof(struct sockaddr_in6);
+ src_sin6.sin6_family = AF_INET6;
+ src_sin6.sin6_addr = *src;
+
+ coa_sin6.sin6_len = sizeof(struct sockaddr_in6);
+ coa_sin6.sin6_family = AF_INET6;
+ coa_sin6.sin6_addr = *coa;
+
+ hoa_sin6.sin6_len = sizeof(struct sockaddr_in6);
+ hoa_sin6.sin6_family = AF_INET6;
+ hoa_sin6.sin6_addr = *hoa;
+
+ mips_notify_be_hint((struct sockaddr *)&src_sin6,
+ (struct sockaddr *)&coa_sin6,
+ (struct sockaddr *)&hoa_sin6, status);
+}
#endif /* MIP6 */
View
20 kame/sys/netinet6/mip6.c
@@ -1,4 +1,4 @@
-/* $Id: mip6.c,v 1.218 2005/05/26 04:22:39 keiichi Exp $ */
+/* $Id: mip6.c,v 1.219 2005/06/09 02:16:11 keiichi Exp $ */
/*
* Copyright (C) 2004 WIDE Project. All rights reserved.
@@ -1552,15 +1552,27 @@ mip6_notify_rr_hint(dst, src)
struct in6_addr *dst;
struct in6_addr *src;
{
+ struct sockaddr_in6 src_sin6, dst_sin6;
+
if (mip6_rr_hint_ratelimit(dst, src)) {
/* rate limited. */
return;
}
- mips_notify_rr_hint(dst, src);
+
+ bzero(&src_sin6, sizeof(struct sockaddr_in6));
+ src_sin6.sin6_len = sizeof(struct sockaddr_in6);
+ src_sin6.sin6_family = AF_INET6;
+ src_sin6.sin6_addr = *src;
+
+ bzero(&dst_sin6, sizeof(struct sockaddr_in6));
+ dst_sin6.sin6_len = sizeof(struct sockaddr_in6);
+ dst_sin6.sin6_family = AF_INET6;
+ dst_sin6.sin6_addr = *dst;
+
+ mips_notify_rr_hint((struct sockaddr *)&dst_sin6,
+ (struct sockaddr *)&src_sin6);
}
-#endif /* NMIP > 0 */
-#if NMIP > 0
static int
mip6_rr_hint_ratelimit(dst, src)
const struct in6_addr *dst; /* not used at this moment */
View
4 kame/sys/netinet6/nd6_rtr.c
@@ -1,4 +1,4 @@
-/* $KAME: nd6_rtr.c,v 1.272 2005/04/14 06:22:42 suz Exp $ */
+/* $KAME: nd6_rtr.c,v 1.273 2005/06/09 02:16:11 keiichi Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -1381,7 +1381,7 @@ prelist_update(new, dr, m, mcast)
*/
if (MIP6_IS_MN && mip6_are_homeprefix(new)) {
mips_notify_home_hint(new->ndpr_ifp->if_index,
- &new->ndpr_prefix.sin6_addr, new->ndpr_plen);
+ (struct sockaddr *)&new->ndpr_prefix, new->ndpr_plen);
goto end;
}
#endif /* MIP6 && NMIP > 0 */
Please sign in to comment.
Something went wrong with that request. Please try again.