Skip to content

Commit

Permalink
u_short cleansing
Browse files Browse the repository at this point in the history
  • Loading branch information
itojun committed Aug 1, 2002
1 parent 896f700 commit 0603191
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions kame/kame/pim6dd/mld6.c
@@ -1,4 +1,4 @@
/* $KAME: mld6.c,v 1.22 2002/03/29 13:35:24 jinmei Exp $ */
/* $KAME: mld6.c,v 1.23 2002/08/01 03:35:01 itojun Exp $ */

/*
* Copyright (C) 1998 WIDE Project.
Expand Down Expand Up @@ -100,7 +100,7 @@ u_int8_t raopt[IP6OPT_RTALERT_LEN];
#endif
static char *sndcmsgbuf;
static int ctlbuflen = 0;
static u_short rtalert_code;
static u_int16_t rtalert_code;

/* local functions */

Expand Down Expand Up @@ -208,7 +208,7 @@ init_mld6()
#ifndef USE_RFC2292BIS
raopt[0] = IP6OPT_ROUTER_ALERT;
raopt[1] = IP6OPT_RTALERT_LEN - 2;
memcpy(&raopt[2], (caddr_t) & rtalert_code, sizeof(u_short));
memcpy(&raopt[2], (caddr_t) & rtalert_code, sizeof(u_int16_t));
#endif

/* register MLD message handler */
Expand Down
24 changes: 12 additions & 12 deletions kame/kame/pim6dd/pim6.c
@@ -1,4 +1,4 @@
/* $KAME: pim6.c,v 1.9 2001/06/25 04:54:13 itojun Exp $ */
/* $KAME: pim6.c,v 1.10 2002/08/01 03:35:01 itojun Exp $ */

/*
* Copyright (C) 1998 WIDE Project.
Expand Down Expand Up @@ -84,7 +84,7 @@ static u_char *sndcmsgbuf = NULL;
*/
static void pim6_read __P((int f, fd_set *rfd));
static void accept_pim6 __P((int recvlen));
static int pim6_cksum __P((u_short *, struct in6_addr *,
static int pim6_cksum __P((u_int16_t *, struct in6_addr *,
struct in6_addr *, int));

void
Expand Down Expand Up @@ -360,11 +360,11 @@ u_int pim_send_cnt = 0;
#define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; ADDCARRY(sum);}

static union {
u_short phs[4];
u_int16_t phs[4];
struct {
u_long ph_len;
u_char ph_zero[3];
u_char ph_nxt;
u_int32_t ph_len;
u_int8_t ph_zero[3];
u_int8_t ph_nxt;
} ph;
} uph;

Expand All @@ -375,19 +375,19 @@ static union {
*/
static int
pim6_cksum(addr, src, dst, len)
u_short *addr;
u_int16_t *addr;
struct in6_addr *src, *dst;
int len;
{
register int nleft = len;
register u_short *w;
register int sum = 0;
u_short answer = 0;
register u_int16_t *w;
register int32_t sum = 0;
u_int16_t answer = 0;

/*
* First create IP6 pseudo header and calculate a summary.
*/
w = (u_short *)src;
w = (u_int16_t *)src;
uph.ph.ph_len = htonl(len);
uph.ph.ph_nxt = IPPROTO_PIM;

Expand All @@ -399,7 +399,7 @@ pim6_cksum(addr, src, dst, len)
sum += w[2]; sum += w[3]; sum += w[4]; sum += w[5];
sum += w[6]; sum += w[7];
/* IPv6 destination address */
w = (u_short *)dst;
w = (u_int16_t *)dst;
sum += w[0];
/* XXX: necessary? */
if (!(IN6_IS_ADDR_LINKLOCAL(dst) || IN6_IS_ADDR_MC_LINKLOCAL(dst)))
Expand Down
6 changes: 3 additions & 3 deletions kame/kame/pim6sd/mld6.c
@@ -1,4 +1,4 @@
/* $KAME: mld6.c,v 1.43 2002/06/26 10:24:47 jinmei Exp $ */
/* $KAME: mld6.c,v 1.44 2002/08/01 03:34:02 itojun Exp $ */

/*
* Copyright (C) 1998 WIDE Project.
Expand Down Expand Up @@ -133,7 +133,7 @@ u_int8_t raopt[IP6OPT_RTALERT_LEN];
#endif
char *sndcmsgbuf;
int ctlbuflen = 0;
static u_short rtalert_code;
static u_int16_t rtalert_code;

/* local functions */

Expand Down Expand Up @@ -252,7 +252,7 @@ init_mld6()
#ifndef USE_RFC2292BIS
raopt[0] = IP6OPT_ROUTER_ALERT;
raopt[1] = IP6OPT_RTALERT_LEN - 2;
memcpy(&raopt[2], (caddr_t) & rtalert_code, sizeof(u_short));
memcpy(&raopt[2], (caddr_t) & rtalert_code, sizeof(u_int16_t));
#endif

/* register MLD message handler */
Expand Down
24 changes: 12 additions & 12 deletions kame/kame/pim6sd/pim6.c
@@ -1,4 +1,4 @@
/* $KAME: pim6.c,v 1.22 2002/06/26 10:24:48 jinmei Exp $ */
/* $KAME: pim6.c,v 1.23 2002/08/01 03:34:02 itojun Exp $ */

/*
* Copyright (C) 1999 LSIIT Laboratory.
Expand Down Expand Up @@ -125,7 +125,7 @@ static int rcvcmsglen;
*/
static void pim6_read __P((int f, fd_set *rfd));
static void accept_pim6 __P((int recvlen));
static int pim6_cksum __P((u_short *, struct in6_addr *,
static int pim6_cksum __P((u_int16_t *, struct in6_addr *,
struct in6_addr *, int));


Expand Down Expand Up @@ -469,11 +469,11 @@ send_pim6(char *buf, struct sockaddr_in6 *src,
#define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; ADDCARRY(sum);}

static union {
u_short phs[4];
u_int16_t phs[4];
struct {
u_long ph_len;
u_char ph_zero[3];
u_char ph_nxt;
u_int32_t ph_len;
u_int8_t ph_zero[3];
u_int8_t ph_nxt;
} ph;
} uph;

Expand All @@ -482,17 +482,17 @@ static union {
* sequential 16 bit words to it, and at the end, fold back all the
* carry bits from the top 16 bits into the lower 16 bits.
*/
int pim6_cksum(u_short *addr, struct in6_addr *src ,struct in6_addr *dst , int len )
int pim6_cksum(u_int16_t *addr, struct in6_addr *src ,struct in6_addr *dst , int len )
{
register int nleft = len;
register u_short *w;
register int sum = 0;
u_short answer = 0;
register u_int16_t *w;
register int32_t sum = 0;
u_int16_t answer = 0;

/*
* First create IP6 pseudo header and calculate a summary.
*/
w = (u_short *)src;
w = (u_int16_t *)src;
uph.ph.ph_len = htonl(len);
uph.ph.ph_nxt = IPPROTO_PIM;

Expand All @@ -504,7 +504,7 @@ int pim6_cksum(u_short *addr, struct in6_addr *src ,struct in6_addr *dst , int l
sum += w[2]; sum += w[3]; sum += w[4]; sum += w[5];
sum += w[6]; sum += w[7];
/* IPv6 destination address */
w = (u_short *)dst;
w = (u_int16_t *)dst;
sum += w[0];
/* XXX: necessary? */
if (!(IN6_IS_ADDR_LINKLOCAL(dst) || IN6_IS_ADDR_MC_LINKLOCAL(dst)))
Expand Down

0 comments on commit 0603191

Please sign in to comment.