Permalink
Browse files

always initialized destination address structures in make_mld6(v2)_ms…

…g().

otherwise, the strucuture may contain garbages in sin6_scope_id,
which might be rejected in recent kernels.
  • Loading branch information...
1 parent e20e028 commit a8f01c617a8975a611abbc9921524ec617a7d126 jinmei committed Mar 29, 2002
Showing with 18 additions and 6 deletions.
  1. +6 −2 kame/kame/pim6dd/mld6.c
  2. +6 −2 kame/kame/pim6sd/mld6.c
  3. +6 −2 kame/kame/pim6sd/mld6v2.c
View
8 kame/kame/pim6dd/mld6.c
@@ -1,4 +1,4 @@
-/* $KAME: mld6.c,v 1.21 2002/01/20 10:25:20 suz Exp $ */
+/* $KAME: mld6.c,v 1.22 2002/03/29 13:35:24 jinmei Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@@ -389,10 +389,14 @@ make_mld6_msg(type, code, src, dst, group, ifindex, delay, datalen, alert)
struct sockaddr_in6 *src, *dst;
struct in6_addr *group;
{
- static struct sockaddr_in6 dst_sa = {sizeof(dst_sa), AF_INET6};
+ struct sockaddr_in6 dst_sa;
struct mld_hdr *mhp = (struct mld_hdr *)mld6_send_buf;
int ctllen, hbhlen = 0;
+ memset(&dst_sa, 0, sizeof(dst_sa));
+ dst_sa.sin6_family = AF_INET6;
+ dst_sa.sin6_len = sizeof(dst_sa);
+
switch(type) {
case MLD_MTRACE:
case MLD_MTRACE_RESP:
View
8 kame/kame/pim6sd/mld6.c
@@ -1,4 +1,4 @@
-/* $KAME: mld6.c,v 1.39 2002/01/20 10:25:20 suz Exp $ */
+/* $KAME: mld6.c,v 1.40 2002/03/29 13:34:50 jinmei Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@@ -442,10 +442,14 @@ make_mld6_msg(type, code, src, dst, group, ifindex, delay, datalen, alert)
struct sockaddr_in6 *src, *dst;
struct in6_addr *group;
{
- static struct sockaddr_in6 dst_sa = {sizeof(dst_sa), AF_INET6};
+ struct sockaddr_in6 dst_sa;
struct mld_hdr *mhp = (struct mld_hdr *)mld6_send_buf;
int ctllen, hbhlen = 0;
+ memset(&dst_sa, 0, sizeof(dst_sa));
+ dst_sa.sin6_family = AF_INET6;
+ dst_sa.sin6_len = sizeof(dst_sa);
+
switch(type) {
case MLD_MTRACE:
case MLD_MTRACE_RESP:
View
8 kame/kame/pim6sd/mld6v2.c
@@ -1,5 +1,5 @@
/*
- * $KAME: mld6v2.c,v 1.8 2002/01/20 15:23:45 suz Exp $
+ * $KAME: mld6v2.c,v 1.9 2002/03/29 13:34:50 jinmei Exp $
*/
/*
@@ -105,7 +105,7 @@ make_mld6v2_msg(int type, int code, struct sockaddr_in6 *src,
unsigned int delay, int datalen, int alert, int sflag,
int qrv, int qqic)
{
- static struct sockaddr_in6 dst_sa = { sizeof(dst_sa), AF_INET6 };
+ struct sockaddr_in6 dst_sa;
struct mldv2_hdr *mhp = (struct mldv2_hdr *) mld6_send_buf;
int ctllen, hbhlen = 0;
int nbsrc = 0;
@@ -116,6 +116,10 @@ make_mld6v2_msg(int type, int code, struct sockaddr_in6 *src,
struct uvif *v;
struct listaddr *g = NULL;
+ memset(&dst_sa, 0, sizeof(dst_sa));
+ dst_sa.sin6_family = AF_INET6;
+ dst_sa.sin6_len = sizeof(dst_sa);
+
if ((vifi = local_address(src)) == NO_VIF) {
IF_DEBUG(DEBUG_MLD)
log(LOG_INFO, 0, "make_mld6v2_msg: can't find a vif");

0 comments on commit a8f01c6

Please sign in to comment.