Remove dead code for address reverse-mapping
Removed get_ipxnet_addr(), get_ether_addr(). If this feature is desired at a minimum it should use an efficent data structure (and no disk-based lookups mid-dissection). Change-Id: Ie72449c631f21f4a3d82ec435bb5e1d7892f122c Reviewed-on: https://code.wireshark.org/review/22729 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
This commit is contained in:
parent
543c101d4b
commit
55724db3db
|
@ -1196,33 +1196,6 @@ get_ethent(unsigned int *mask, const gboolean manuf_file)
|
|||
|
||||
} /* get_ethent */
|
||||
|
||||
#if 0
|
||||
static ether_t *
|
||||
get_ethbyname(const gchar *name)
|
||||
{
|
||||
ether_t *eth;
|
||||
|
||||
set_ethent(g_pethers_path);
|
||||
|
||||
while (((eth = get_ethent(NULL, FALSE)) != NULL) && strncmp(name, eth->name, MAXNAMELEN) != 0)
|
||||
;
|
||||
|
||||
if (eth == NULL) {
|
||||
end_ethent();
|
||||
|
||||
set_ethent(g_ethers_path);
|
||||
|
||||
while (((eth = get_ethent(NULL, FALSE)) != NULL) && strncmp(name, eth->name, MAXNAMELEN) != 0)
|
||||
;
|
||||
|
||||
end_ethent();
|
||||
}
|
||||
|
||||
return eth;
|
||||
|
||||
} /* get_ethbyname */
|
||||
#endif
|
||||
|
||||
static ether_t *
|
||||
get_ethbyaddr(const guint8 *addr)
|
||||
{
|
||||
|
@ -1426,7 +1399,7 @@ initialize_ethers(void)
|
|||
}
|
||||
|
||||
/* Set g_pethers_path here, but don't actually do anything
|
||||
* with it. It's used in get_ethbyname() and get_ethbyaddr()
|
||||
* with it. XXX - It used to be used in get_ethbyname() and get_ethbyaddr()
|
||||
*/
|
||||
if (g_pethers_path == NULL)
|
||||
g_pethers_path = get_persconffile_path(ENAME_ETHERS, FALSE);
|
||||
|
@ -1622,41 +1595,6 @@ eth_name_lookup(const guint8 *addr, const gboolean resolve)
|
|||
|
||||
} /* eth_name_lookup */
|
||||
|
||||
static guint8 *
|
||||
eth_addr_lookup(const gchar *name _U_)
|
||||
{
|
||||
#if 0
|
||||
/* XXX Do we need reverse lookup??? */
|
||||
ether_t *eth;
|
||||
hashether_t *tp;
|
||||
hashether_t **table = eth_table;
|
||||
gint i;
|
||||
|
||||
/* to be optimized (hash table from name to addr) */
|
||||
for (i = 0; i < HASHETHSIZE; i++) {
|
||||
tp = table[i];
|
||||
while (tp) {
|
||||
if (strcmp(tp->resolved_name, name) == 0)
|
||||
return tp->addr;
|
||||
tp = tp->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* not in hash table : performs a file lookup */
|
||||
|
||||
if ((eth = get_ethbyname(name)) == NULL)
|
||||
return NULL;
|
||||
|
||||
/* add new entry in hash table */
|
||||
|
||||
tp = add_eth_name(eth->addr, name);
|
||||
|
||||
return tp->addr;
|
||||
#endif
|
||||
return NULL;
|
||||
|
||||
} /* eth_addr_lookup */
|
||||
|
||||
|
||||
/* IPXNETS */
|
||||
static int
|
||||
|
@ -1751,34 +1689,6 @@ get_ipxnetent(void)
|
|||
|
||||
} /* get_ipxnetent */
|
||||
|
||||
/* Unused ??? */
|
||||
#if 0
|
||||
static ipxnet_t *
|
||||
get_ipxnetbyname(const gchar *name)
|
||||
{
|
||||
ipxnet_t *ipxnet;
|
||||
|
||||
set_ipxnetent(g_ipxnets_path);
|
||||
|
||||
while (((ipxnet = get_ipxnetent()) != NULL) && strncmp(name, ipxnet->name, MAXNAMELEN) != 0)
|
||||
;
|
||||
|
||||
if (ipxnet == NULL) {
|
||||
end_ipxnetent();
|
||||
|
||||
set_ipxnetent(g_pipxnets_path);
|
||||
|
||||
while (((ipxnet = get_ipxnetent()) != NULL) && strncmp(name, ipxnet->name, MAXNAMELEN) != 0)
|
||||
;
|
||||
|
||||
end_ipxnetent();
|
||||
}
|
||||
|
||||
return ipxnet;
|
||||
|
||||
} /* get_ipxnetbyname */
|
||||
#endif
|
||||
|
||||
static ipxnet_t *
|
||||
get_ipxnetbyaddr(guint32 addr)
|
||||
{
|
||||
|
@ -1819,7 +1729,7 @@ initialize_ipxnets(void)
|
|||
}
|
||||
|
||||
/* Set g_pipxnets_path here, but don't actually do anything
|
||||
* with it. It's used in get_ipxnetbyname() and get_ipxnetbyaddr()
|
||||
* with it. XXX - It used to be used in get_ipxnetbyname() and get_ipxnetbyaddr()
|
||||
*/
|
||||
if (g_pipxnets_path == NULL)
|
||||
g_pipxnets_path = get_persconffile_path(ENAME_IPXNETS, FALSE);
|
||||
|
@ -1834,35 +1744,6 @@ ipx_name_lookup_cleanup(void)
|
|||
g_pipxnets_path = NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static hashipxnet_t *
|
||||
add_ipxnet_name(guint addr, const gchar *name)
|
||||
{
|
||||
hashipxnet_t *tp;
|
||||
|
||||
tp = (hashipxnet_t *)g_hash_table_lookup(ipxnet_hash_table, &addr);
|
||||
if (tp) {
|
||||
g_strlcpy(tp->name, name, MAXNAMELEN);
|
||||
} else {
|
||||
int *key;
|
||||
|
||||
key = (int *)g_new(int, 1);
|
||||
*key = addr;
|
||||
tp = g_new(hashipxnet_t,1);
|
||||
g_strlcpy(tp->name, name, MAXNAMELEN);
|
||||
g_hash_table_insert(ipxnet_hash_table, key, tp);
|
||||
}
|
||||
|
||||
tp->addr = addr;
|
||||
g_strlcpy(tp->name, name, MAXNAMELEN);
|
||||
tp->next = NULL;
|
||||
new_resolved_objects = TRUE;
|
||||
|
||||
return tp;
|
||||
|
||||
} /* add_ipxnet_name */
|
||||
#endif
|
||||
|
||||
static gchar *
|
||||
ipxnet_name_lookup(wmem_allocator_t *allocator, const guint addr)
|
||||
{
|
||||
|
@ -1897,46 +1778,6 @@ ipxnet_name_lookup(wmem_allocator_t *allocator, const guint addr)
|
|||
|
||||
} /* ipxnet_name_lookup */
|
||||
|
||||
static guint
|
||||
ipxnet_addr_lookup(const gchar *name _U_, gboolean *success)
|
||||
{
|
||||
*success = FALSE;
|
||||
return 0;
|
||||
#if 0
|
||||
/* XXX Do we need reverse lookup??? */
|
||||
ipxnet_t *ipxnet;
|
||||
hashipxnet_t *tp;
|
||||
hashipxnet_t **table = ipxnet_table;
|
||||
int i;
|
||||
|
||||
/* to be optimized (hash table from name to addr) */
|
||||
for (i = 0; i < HASHIPXNETSIZE; i++) {
|
||||
tp = table[i];
|
||||
while (tp) {
|
||||
if (strcmp(tp->name, name) == 0) {
|
||||
*success = TRUE;
|
||||
return tp->addr;
|
||||
}
|
||||
tp = tp->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* not in hash table : performs a file lookup */
|
||||
|
||||
if ((ipxnet = get_ipxnetbyname(name)) == NULL) {
|
||||
*success = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* add new entry in hash table */
|
||||
|
||||
tp = add_ipxnet_name(ipxnet->addr, name);
|
||||
|
||||
*success = TRUE;
|
||||
return tp->addr;
|
||||
#endif
|
||||
} /* ipxnet_addr_lookup */
|
||||
|
||||
/* VLANS */
|
||||
static int
|
||||
parse_vlan_line(char *line, vlan_t *vlan)
|
||||
|
@ -3102,15 +2943,6 @@ get_ether_name_if_known(const guint8 *addr)
|
|||
}
|
||||
}
|
||||
|
||||
guint8 *
|
||||
get_ether_addr(const gchar *name)
|
||||
{
|
||||
|
||||
/* force resolution (do not check gbl_resolv_flags) */
|
||||
return eth_addr_lookup(name);
|
||||
|
||||
} /* get_ether_addr */
|
||||
|
||||
void
|
||||
add_ether_byip(const guint ip, const guint8 *eth)
|
||||
{
|
||||
|
@ -3156,20 +2988,6 @@ get_ipxnet_name(wmem_allocator_t *allocator, const guint32 addr)
|
|||
|
||||
} /* get_ipxnet_name */
|
||||
|
||||
guint32
|
||||
get_ipxnet_addr(const gchar *name, gboolean *known)
|
||||
{
|
||||
guint32 addr;
|
||||
gboolean success;
|
||||
|
||||
/* force resolution (do not check gbl_resolv_flags) */
|
||||
addr = ipxnet_addr_lookup(name, &success);
|
||||
|
||||
*known = success;
|
||||
return addr;
|
||||
|
||||
} /* get_ipxnet_addr */
|
||||
|
||||
gchar *
|
||||
get_vlan_name(wmem_allocator_t *allocator, const guint16 id)
|
||||
{
|
||||
|
|
|
@ -283,14 +283,6 @@ WS_DLL_PUBLIC char* get_hash_ether_resolved_name(hashether_t* ether);
|
|||
WS_DLL_PUBLIC char* get_hash_manuf_resolved_name(hashmanuf_t* manuf);
|
||||
|
||||
|
||||
/* returns the ethernet address corresponding to name or NULL if not known */
|
||||
extern guint8 *get_ether_addr(const gchar *name);
|
||||
|
||||
/* returns the ipx network corresponding to name. If name is unknown,
|
||||
* 0 is returned and 'known' is set to FALSE. On success, 'known'
|
||||
* is set to TRUE. */
|
||||
guint32 get_ipxnet_addr(const gchar *name, gboolean *known);
|
||||
|
||||
/* adds a hostname/IPv4 in the hash table */
|
||||
WS_DLL_PUBLIC void add_ipv4_name(const guint addr, const gchar *name);
|
||||
|
||||
|
|
|
@ -370,8 +370,6 @@ vines_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, g
|
|||
static gboolean
|
||||
ether_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
|
||||
{
|
||||
guint8 *mac;
|
||||
|
||||
/*
|
||||
* Don't request an error message if bytes_from_unparsed fails;
|
||||
* if it does, we'll report an error specific to this address
|
||||
|
@ -396,17 +394,11 @@ ether_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, g
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
mac = get_ether_addr(s);
|
||||
if (!mac) {
|
||||
if (err_msg != NULL) {
|
||||
*err_msg = g_strdup_printf("\"%s\" is not a valid hostname or Ethernet address.",
|
||||
s);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
/* XXX - Try resolving as an Ethernet host name and parse that? */
|
||||
|
||||
ether_fvalue_set(fv, mac);
|
||||
return TRUE;
|
||||
if (err_msg != NULL)
|
||||
*err_msg = g_strdup_printf("\"%s\" is not a valid Ethernet address.", s);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -504,26 +504,19 @@ char_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, int field_display, char *buf, uns
|
|||
static gboolean
|
||||
ipxnet_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
|
||||
{
|
||||
guint32 val;
|
||||
gboolean known;
|
||||
|
||||
/*
|
||||
* Don't request an errror message if uint32_from_unparsed fails;
|
||||
* if it does, we'll try looking it up as an IPX network name, and
|
||||
* if that fails, we'll report an error message for that.
|
||||
* Don't request an error message if bytes_from_unparsed fails;
|
||||
* if it does, we'll report an error specific to this address
|
||||
* type.
|
||||
*/
|
||||
if (uint32_from_unparsed(fv, s, TRUE, NULL)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
val = get_ipxnet_addr(s, &known);
|
||||
if (known) {
|
||||
fv->value.uinteger = val;
|
||||
return TRUE;
|
||||
}
|
||||
/* XXX - Try resolving as an IPX host name and parse that? */
|
||||
|
||||
if (err_msg != NULL)
|
||||
*err_msg = g_strdup_printf("\"%s\" is not a valid IPX network name or address.", s);
|
||||
*err_msg = g_strdup_printf("\"%s\" is not a valid IPX network address.", s);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue