1*05b00f60SXin Li /*
2*05b00f60SXin Li * Copyright (c) 2013 Romain Francoise <[email protected]>
3*05b00f60SXin Li *
4*05b00f60SXin Li * Redistribution and use in source and binary forms, with or without
5*05b00f60SXin Li * modification, are permitted provided that the following conditions
6*05b00f60SXin Li * are met:
7*05b00f60SXin Li * 1. Redistributions of source code must retain the above copyright
8*05b00f60SXin Li * notice, this list of conditions and the following disclaimer.
9*05b00f60SXin Li * 2. Redistributions in binary form must reproduce the above copyright
10*05b00f60SXin Li * notice, this list of conditions and the following disclaimer in the
11*05b00f60SXin Li * documentation and/or other materials provided with the distribution.
12*05b00f60SXin Li * 3. Neither the name of the project nor the names of its contributors
13*05b00f60SXin Li * may be used to endorse or promote products derived from this software
14*05b00f60SXin Li * without specific prior written permission.
15*05b00f60SXin Li *
16*05b00f60SXin Li * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
17*05b00f60SXin Li * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*05b00f60SXin Li * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*05b00f60SXin Li * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
20*05b00f60SXin Li * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*05b00f60SXin Li * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22*05b00f60SXin Li * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23*05b00f60SXin Li * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24*05b00f60SXin Li * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*05b00f60SXin Li * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26*05b00f60SXin Li * SUCH DAMAGE.
27*05b00f60SXin Li */
28*05b00f60SXin Li
29*05b00f60SXin Li /* \summary: MS Network Load Balancing's (NLB) heartbeat printer */
30*05b00f60SXin Li
31*05b00f60SXin Li #ifdef HAVE_CONFIG_H
32*05b00f60SXin Li #include <config.h>
33*05b00f60SXin Li #endif
34*05b00f60SXin Li
35*05b00f60SXin Li #include "netdissect-stdinc.h"
36*05b00f60SXin Li
37*05b00f60SXin Li #include "netdissect.h"
38*05b00f60SXin Li #include "addrtoname.h"
39*05b00f60SXin Li #include "extract.h"
40*05b00f60SXin Li
41*05b00f60SXin Li struct msnlb_heartbeat_pkt {
42*05b00f60SXin Li nd_byte unknown1[4];
43*05b00f60SXin Li nd_byte unknown2[4];
44*05b00f60SXin Li nd_uint32_t host_prio; /* little-endian */
45*05b00f60SXin Li nd_ipv4 virtual_ip;
46*05b00f60SXin Li nd_ipv4 host_ip;
47*05b00f60SXin Li /* the protocol is undocumented so we ignore the rest */
48*05b00f60SXin Li };
49*05b00f60SXin Li
50*05b00f60SXin Li void
msnlb_print(netdissect_options * ndo,const u_char * bp)51*05b00f60SXin Li msnlb_print(netdissect_options *ndo, const u_char *bp)
52*05b00f60SXin Li {
53*05b00f60SXin Li const struct msnlb_heartbeat_pkt *hb;
54*05b00f60SXin Li
55*05b00f60SXin Li ndo->ndo_protocol = "msnlb";
56*05b00f60SXin Li hb = (const struct msnlb_heartbeat_pkt *)bp;
57*05b00f60SXin Li
58*05b00f60SXin Li ND_PRINT("MS NLB heartbeat");
59*05b00f60SXin Li ND_PRINT(", host priority: %u", GET_LE_U_4((hb->host_prio)));
60*05b00f60SXin Li ND_PRINT(", cluster IP: %s", GET_IPADDR_STRING(hb->virtual_ip));
61*05b00f60SXin Li ND_PRINT(", host IP: %s", GET_IPADDR_STRING(hb->host_ip));
62*05b00f60SXin Li }
63