Coverage Report

Created: 2025-02-15 06:25

/src/wireshark/epan/dissectors/packet-ans.c
Line
Count
Source
1
/* packet-ans.c
2
 * Routines for Intel ANS probe dissection
3
 *
4
 * Wireshark - Network traffic analyzer
5
 * By Gerald Combs <gerald@wireshark.org>
6
 * Copyright 2003 Gerald Combs
7
 *
8
 * SPDX-License-Identifier: GPL-2.0-or-later
9
 *
10
 * The following information was graciously provided by Intel:
11
 * Offset    Size (bytes)    Contents
12
 * 0         6               Destination Broadcast probes: {FF,FF,FF,FF,FF,FF}
13
 *                           Multicast probes: {01,AA,00,00,00,00}
14
 * 6         6               Source Matches the CurrentMACAddress of the
15
 *                           adapter sending the probe.
16
 * 8         2               Type Network order is 0x886D, Intel's reserved
17
 *                           packet type.
18
 * 10 (0)    2               ApplicationID Network order is 0x0001, identifies
19
 *                           it as fault tolerance probe.
20
 * 12 (2)    2               RevID Network order, identifies the revision id
21
 *                           of Teaming software.
22
 * 16 (4)    4               ProbeSequenceNumber Ascending sequence number
23
 *                           that identifies the current probing cycle.
24
 * 20 (8)    2               SenderID Unique ID within a team identifying
25
 *                           the member that originally sent the probe.
26
 * 22 (10)   6               TeamID Unique ID identifying the team in charge
27
 *                           of this probe.
28
 * 28        Padding         Reserved
29
 *
30
 */
31
32
#include "config.h"
33
34
#include <epan/packet.h>
35
#include <epan/to_str.h>
36
#include <epan/etypes.h>
37
38
void proto_register_ans(void);
39
void proto_reg_handoff_ans(void);
40
41
static dissector_handle_t ans_handle;
42
43
/* Initialize the protocol and registered fields */
44
static int proto_ans;
45
46
static int hf_ans_app_id;
47
static int hf_ans_rev_id;
48
static int hf_ans_seq_num;
49
static int hf_ans_sender_id;
50
static int hf_ans_team_id;
51
52
/* Initialize the subtree pointers */
53
static int ett_ans;
54
55
/* Code to actually dissect the packets */
56
static int
57
dissect_ans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
58
6
{
59
6
  proto_item  *ti;
60
6
  proto_tree  *ans_tree;
61
6
  uint16_t     sender_id;
62
6
  uint32_t     seq_num;
63
64
6
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "Intel ANS probe");
65
66
6
  seq_num = tvb_get_ntohl(tvb, 4);
67
6
  sender_id = tvb_get_ntohs(tvb, 8);
68
69
6
  col_add_fstr(pinfo->cinfo, COL_INFO, "Sequence: %u, Sender ID %u, Team ID %s",
70
6
    seq_num, sender_id, tvb_ether_to_str(pinfo->pool, tvb, 10));
71
72
6
  ti = proto_tree_add_item(tree, proto_ans, tvb, 0, -1, ENC_NA);
73
6
  ans_tree = proto_item_add_subtree(ti, ett_ans);
74
75
6
  proto_tree_add_item(ans_tree, hf_ans_app_id, tvb, 0, 2, ENC_BIG_ENDIAN);
76
6
  proto_tree_add_item(ans_tree, hf_ans_rev_id, tvb, 2, 2, ENC_BIG_ENDIAN);
77
6
  proto_tree_add_item(ans_tree, hf_ans_seq_num, tvb, 4, 4, ENC_BIG_ENDIAN);
78
6
  proto_tree_add_item(ans_tree, hf_ans_sender_id, tvb, 8, 2, ENC_BIG_ENDIAN);
79
6
  proto_tree_add_item(ans_tree, hf_ans_team_id, tvb, 10, 6, ENC_NA);
80
81
6
  return tvb_captured_length(tvb);
82
6
}
83
84
85
void
86
proto_register_ans(void)
87
14
{
88
14
  static hf_register_info hf[] = {
89
14
    { &hf_ans_app_id,
90
14
      { "Application ID", "ans.app_id",
91
14
        FT_UINT16, BASE_HEX, NULL, 0,
92
14
        "Intel ANS Application ID", HFILL }
93
14
    },
94
14
    { &hf_ans_rev_id,
95
14
      { "Revision ID", "ans.rev_id",
96
14
        FT_UINT16, BASE_HEX, NULL, 0,
97
14
        "Intel ANS Revision ID", HFILL }
98
14
    },
99
14
    { &hf_ans_seq_num,
100
14
      { "Sequence Number", "ans.seq_num",
101
14
        FT_UINT32, BASE_DEC, NULL, 0,
102
14
        "Intel ANS Sequence Number", HFILL }
103
14
    },
104
14
    { &hf_ans_sender_id,
105
14
      { "Sender ID", "ans.sender_id",
106
14
        FT_UINT16, BASE_DEC, NULL, 0,
107
14
        "Intel ANS Sender ID", HFILL }
108
14
    },
109
14
    { &hf_ans_team_id,
110
14
      { "Team ID", "ans.team_id",
111
14
        FT_ETHER, BASE_NONE, NULL, 0,
112
14
        "Intel ANS Team ID", HFILL }
113
14
    },
114
14
  };
115
116
14
  static int *ett[] = {
117
14
    &ett_ans,
118
14
  };
119
120
14
  proto_ans = proto_register_protocol("Intel ANS probe", "ANS", "ans");
121
14
  proto_register_field_array(proto_ans, hf, array_length(hf));
122
14
  proto_register_subtree_array(ett, array_length(ett));
123
124
14
  ans_handle = register_dissector("ans", dissect_ans, proto_ans);
125
14
}
126
127
128
void
129
proto_reg_handoff_ans(void)
130
14
{
131
14
  dissector_add_uint("ethertype", ETHERTYPE_INTEL_ANS, ans_handle);
132
14
}
133
134
/*
135
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
136
 *
137
 * Local variables:
138
 * c-basic-offset: 8
139
 * tab-width: 8
140
 * indent-tabs-mode: t
141
 * End:
142
 *
143
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
144
 * :indentSize=8:tabSize=8:noTabs=false:
145
 */