]> git.pld-linux.org Git - packages/cacti-spine.git/blob - ping_reliability.patch
- add 3 official patches
[packages/cacti-spine.git] / ping_reliability.patch
1 --- 0.8.7e/ping.c       2009-06-28 21:45:02.000000000 -0400
2 +++ ../branches/0.8.7/ping.c    2009-08-18 20:51:30.000000000 -0400
3 @@ -890,7 +890,7 @@
4         return(cleaned_hostname);
5  }
6  
7 -/*! \fn unsigned short get_checksum(void* buf, int len)
8 +/*! \fn unsigned short int get_checksum(void* buf, int len)
9   *  \brief calculates a 16bit checksum of a packet buffer
10   *  \param buf the input buffer to calculate the checksum of
11   *  \param len the size of the input buffer
12 @@ -898,11 +898,12 @@
13   *  \return 16bit checksum of an input buffer of size len.
14   *
15   */
16 -unsigned short get_checksum(void* buf, int len) {
17 +unsigned short int get_checksum(void* buf, int len) {
18         int      nleft = len;
19         int32_t  sum   = 0;
20 -       unsigned short answer;
21 -       unsigned short* w = (unsigned short*)buf;
22 +       unsigned short int answer;
23 +       unsigned short int* w = (unsigned short int*)buf;
24 +       unsigned short int odd_byte = 0;
25  
26         while (nleft > 1) {
27                 sum += *w++;
28 @@ -910,7 +911,8 @@
29         }
30  
31         if (nleft == 1) {
32 -               sum += *(unsigned char*)w;
33 +               *(unsigned char*)(&odd_byte) = *(unsigned char*)w;
34 +               sum += odd_byte;
35         }
36  
37         sum    = (sum >> 16) + (sum & 0xffff);
38 --- 0.8.7e/ping.h       2009-06-28 21:45:02.000000000 -0400
39 +++ ../branches/0.8.7/ping.h    2009-08-18 20:51:30.000000000 -0400
40 @@ -142,4 +142,4 @@
41  extern char *remove_tcp_udp_from_hostname(char *hostname);
42  extern void update_host_status(int status, host_t *host, ping_t *ping, int availability_method);
43  extern int init_sockaddr(struct sockaddr_in *name, const char *hostname, unsigned short int port);
44 -extern unsigned short get_checksum(void* buf, int len);
45 +extern unsigned short int get_checksum(void* buf, int len);
This page took 0.105839 seconds and 3 git commands to generate.