Convert a few more dissectors to wmem
svn path=/trunk/; revision=51991
This commit is contained in:
parent
2e9cd19c9c
commit
6cedc2c336
|
@ -28,6 +28,7 @@
|
|||
#include <glib.h>
|
||||
|
||||
#include <epan/packet.h>
|
||||
#include <epan/wmem/wmem.h>
|
||||
|
||||
void proto_register_babel(void);
|
||||
void proto_reg_handoff_babel(void);
|
||||
|
@ -119,7 +120,7 @@ format_address(const unsigned char *prefix)
|
|||
static const char *
|
||||
format_prefix(const unsigned char *prefix, unsigned char plen)
|
||||
{
|
||||
return ep_strdup_printf("%s/%u", format_address(prefix), plen);
|
||||
return wmem_strdup_printf(wmem_packet_scope(), "%s/%u", format_address(prefix), plen);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <glib.h>
|
||||
|
||||
#include <epan/packet.h>
|
||||
#include <epan/wmem/wmem.h>
|
||||
#include <epan/reassemble.h>
|
||||
#include <epan/expert.h>
|
||||
#include <epan/stats_tree.h>
|
||||
|
@ -4673,8 +4674,8 @@ bacapp_stats_tree_packet(stats_tree* st, packet_info* pinfo, epan_dissect_t* edt
|
|||
gchar *srcstr;
|
||||
const bacapp_info_value_t *binfo = (const bacapp_info_value_t *)p;
|
||||
|
||||
srcstr = ep_strconcat("Src: ", address_to_str(&pinfo->src), NULL);
|
||||
dststr = ep_strconcat("Dst: ", address_to_str(&pinfo->dst), NULL);
|
||||
srcstr = wmem_strconcat(wmem_packet_scope(), "Src: ", address_to_str(&pinfo->src), NULL);
|
||||
dststr = wmem_strconcat(wmem_packet_scope(), "Dst: ", address_to_str(&pinfo->dst), NULL);
|
||||
|
||||
tick_stat_node(st, st_str_packets_by_ip, 0, TRUE);
|
||||
packets_for_this_dst = tick_stat_node(st, st_str_packets_by_ip_dst, st_node_packets_by_ip, TRUE);
|
||||
|
@ -4719,8 +4720,8 @@ bacapp_stats_tree_service(stats_tree* st, packet_info* pinfo, epan_dissect_t* ed
|
|||
|
||||
const bacapp_info_value_t *binfo = (const bacapp_info_value_t *)p;
|
||||
|
||||
srcstr = ep_strconcat("Src: ", address_to_str(&pinfo->src), NULL);
|
||||
dststr = ep_strconcat("Dst: ", address_to_str(&pinfo->dst), NULL);
|
||||
srcstr = wmem_strconcat(wmem_packet_scope(), "Src: ", address_to_str(&pinfo->src), NULL);
|
||||
dststr = wmem_strconcat(wmem_packet_scope(), "Dst: ", address_to_str(&pinfo->dst), NULL);
|
||||
|
||||
tick_stat_node(st, st_str_packets_by_service, 0, TRUE);
|
||||
if (binfo->service_type) {
|
||||
|
@ -4757,8 +4758,8 @@ bacapp_stats_tree_objectid(stats_tree* st, packet_info* pinfo, epan_dissect_t* e
|
|||
gchar *srcstr;
|
||||
const bacapp_info_value_t *binfo = (const bacapp_info_value_t *)p;
|
||||
|
||||
srcstr = ep_strconcat("Src: ", address_to_str(&pinfo->src), NULL);
|
||||
dststr = ep_strconcat("Dst: ", address_to_str(&pinfo->dst), NULL);
|
||||
srcstr = wmem_strconcat(wmem_packet_scope(), "Src: ", address_to_str(&pinfo->src), NULL);
|
||||
dststr = wmem_strconcat(wmem_packet_scope(), "Dst: ", address_to_str(&pinfo->dst), NULL);
|
||||
|
||||
tick_stat_node(st, st_str_packets_by_objectid, 0, TRUE);
|
||||
if (binfo->object_ident) {
|
||||
|
@ -4795,8 +4796,8 @@ bacapp_stats_tree_instanceid(stats_tree* st, packet_info* pinfo, epan_dissect_t*
|
|||
gchar *srcstr;
|
||||
const bacapp_info_value_t *binfo = (const bacapp_info_value_t *)p;
|
||||
|
||||
srcstr = ep_strconcat("Src: ", address_to_str(&pinfo->src), NULL);
|
||||
dststr = ep_strconcat("Dst: ", address_to_str(&pinfo->dst), NULL);
|
||||
srcstr = wmem_strconcat(wmem_packet_scope(), "Src: ", address_to_str(&pinfo->src), NULL);
|
||||
dststr = wmem_strconcat(wmem_packet_scope(), "Dst: ", address_to_str(&pinfo->dst), NULL);
|
||||
|
||||
tick_stat_node(st, st_str_packets_by_instanceid, 0, TRUE);
|
||||
if (binfo->object_ident) {
|
||||
|
@ -5757,11 +5758,14 @@ fObjectIdentifier (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint of
|
|||
|
||||
/* update BACnet Statistics */
|
||||
updateBacnetInfoValue(BACINFO_OBJECTID,
|
||||
ep_strdup(val_to_split_str(object_type, 128,
|
||||
wmem_strdup(wmem_packet_scope(),
|
||||
val_to_split_str(object_type, 128,
|
||||
BACnetObjectType, ASHRAE_Reserved_Fmt,
|
||||
Vendor_Proprietary_Fmt)));
|
||||
updateBacnetInfoValue(BACINFO_INSTANCEID, ep_strdup_printf("Instance ID: %u",
|
||||
object_id_instance(object_id)));
|
||||
updateBacnetInfoValue(BACINFO_INSTANCEID,
|
||||
wmem_strdup_printf(wmem_packet_scope(),
|
||||
"Instance ID: %u",
|
||||
object_id_instance(object_id)));
|
||||
|
||||
/* here are the details of how we arrived at the above text */
|
||||
subtree = proto_item_add_subtree(ti, ett_bacapp_tag);
|
||||
|
@ -7330,7 +7334,8 @@ fBACnetPropertyStates(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, g
|
|||
const gchar* label;
|
||||
|
||||
fTagHeader (tvb, pinfo, offset, &tag_no, &tag_info, &lvt);
|
||||
label = ep_strdup_printf( "%s: ", val_to_str_const( tag_no, VALS(BACnetPropertyStates), "Unknown State" ));
|
||||
label = wmem_strdup_printf(wmem_packet_scope(), "%s: ",
|
||||
val_to_str_const( tag_no, VALS(BACnetPropertyStates), "Unknown State" ));
|
||||
|
||||
switch (tag_no) {
|
||||
case 0:
|
||||
|
@ -10642,13 +10647,14 @@ dissect_bacapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
bacapp_invoke_id);
|
||||
|
||||
updateBacnetInfoValue(BACINFO_INVOKEID,
|
||||
ep_strdup_printf("Invoke ID: %d", bacapp_invoke_id));
|
||||
wmem_strdup_printf(wmem_packet_scope(), "Invoke ID: %d", bacapp_invoke_id));
|
||||
|
||||
updateBacnetInfoValue(BACINFO_SERVICE,
|
||||
ep_strconcat(val_to_str_const(bacapp_service,
|
||||
BACnetConfirmedServiceChoice,
|
||||
bacapp_unknown_service_str),
|
||||
confsreqstr, NULL));
|
||||
wmem_strconcat(wmem_packet_scope(),
|
||||
val_to_str_const(bacapp_service,
|
||||
BACnetConfirmedServiceChoice,
|
||||
bacapp_unknown_service_str),
|
||||
confsreqstr, NULL));
|
||||
break;
|
||||
case BACAPP_TYPE_UNCONFIRMED_SERVICE_REQUEST:
|
||||
bacapp_service = tvb_get_guint8(tvb, offset + 1);
|
||||
|
@ -10658,10 +10664,11 @@ dissect_bacapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
bacapp_unknown_service_str));
|
||||
|
||||
updateBacnetInfoValue(BACINFO_SERVICE,
|
||||
ep_strconcat(val_to_str_const(bacapp_service,
|
||||
BACnetUnconfirmedServiceChoice,
|
||||
bacapp_unknown_service_str),
|
||||
uconfsreqstr, NULL));
|
||||
wmem_strconcat(wmem_packet_scope(),
|
||||
val_to_str_const(bacapp_service,
|
||||
BACnetUnconfirmedServiceChoice,
|
||||
bacapp_unknown_service_str),
|
||||
uconfsreqstr, NULL));
|
||||
break;
|
||||
case BACAPP_TYPE_SIMPLE_ACK:
|
||||
bacapp_invoke_id = tvb_get_guint8(tvb, offset + 1);
|
||||
|
@ -10673,13 +10680,15 @@ dissect_bacapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
bacapp_invoke_id);
|
||||
|
||||
updateBacnetInfoValue(BACINFO_INVOKEID,
|
||||
ep_strdup_printf("Invoke ID: %d", bacapp_invoke_id));
|
||||
wmem_strdup_printf(wmem_packet_scope(),
|
||||
"Invoke ID: %d", bacapp_invoke_id));
|
||||
|
||||
updateBacnetInfoValue(BACINFO_SERVICE,
|
||||
ep_strconcat(val_to_str_const(bacapp_service,
|
||||
BACnetConfirmedServiceChoice,
|
||||
bacapp_unknown_service_str),
|
||||
sackstr, NULL));
|
||||
wmem_strconcat(wmem_packet_scope(),
|
||||
val_to_str_const(bacapp_service,
|
||||
BACnetConfirmedServiceChoice,
|
||||
bacapp_unknown_service_str),
|
||||
sackstr, NULL));
|
||||
break;
|
||||
case BACAPP_TYPE_COMPLEX_ACK:
|
||||
/* segmented messages have 2 additional bytes */
|
||||
|
@ -10703,13 +10712,14 @@ dissect_bacapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
bacapp_invoke_id);
|
||||
|
||||
updateBacnetInfoValue(BACINFO_INVOKEID,
|
||||
ep_strdup_printf("Invoke ID: %d", bacapp_invoke_id));
|
||||
wmem_strdup_printf(wmem_packet_scope(), "Invoke ID: %d", bacapp_invoke_id));
|
||||
|
||||
updateBacnetInfoValue(BACINFO_SERVICE,
|
||||
ep_strconcat(val_to_str_const(bacapp_service,
|
||||
BACnetConfirmedServiceChoice,
|
||||
bacapp_unknown_service_str),
|
||||
cackstr, NULL));
|
||||
wmem_strconcat(wmem_packet_scope(),
|
||||
val_to_str_const(bacapp_service,
|
||||
BACnetConfirmedServiceChoice,
|
||||
bacapp_unknown_service_str),
|
||||
cackstr, NULL));
|
||||
break;
|
||||
case BACAPP_TYPE_SEGMENT_ACK:
|
||||
/* nothing more to add */
|
||||
|
@ -10724,14 +10734,15 @@ dissect_bacapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
bacapp_invoke_id);
|
||||
|
||||
updateBacnetInfoValue(BACINFO_INVOKEID,
|
||||
ep_strdup_printf("Invoke ID: %d", bacapp_invoke_id));
|
||||
wmem_strdup_printf(wmem_packet_scope(), "Invoke ID: %d", bacapp_invoke_id));
|
||||
|
||||
updateBacnetInfoValue(BACINFO_SERVICE,
|
||||
ep_strconcat(errstr,
|
||||
val_to_str_const(bacapp_service,
|
||||
BACnetConfirmedServiceChoice,
|
||||
bacapp_unknown_service_str),
|
||||
NULL));
|
||||
wmem_strconcat(wmem_packet_scope(),
|
||||
errstr,
|
||||
val_to_str_const(bacapp_service,
|
||||
BACnetConfirmedServiceChoice,
|
||||
bacapp_unknown_service_str),
|
||||
NULL));
|
||||
break;
|
||||
case BACAPP_TYPE_REJECT:
|
||||
bacapp_invoke_id = tvb_get_guint8(tvb, offset + 1);
|
||||
|
@ -10744,15 +10755,15 @@ dissect_bacapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
Vendor_Proprietary_Fmt), bacapp_invoke_id);
|
||||
|
||||
updateBacnetInfoValue(BACINFO_INVOKEID,
|
||||
ep_strdup_printf("Invoke ID: %d", bacapp_invoke_id));
|
||||
wmem_strdup_printf(wmem_packet_scope(), "Invoke ID: %d", bacapp_invoke_id));
|
||||
|
||||
updateBacnetInfoValue(BACINFO_SERVICE,
|
||||
ep_strconcat(rejstr,
|
||||
val_to_split_str(bacapp_reason, 64,
|
||||
BACnetRejectReason,
|
||||
ASHRAE_Reserved_Fmt,
|
||||
Vendor_Proprietary_Fmt),
|
||||
NULL));
|
||||
wmem_strconcat(wmem_packet_scope(), rejstr,
|
||||
val_to_split_str(bacapp_reason, 64,
|
||||
BACnetRejectReason,
|
||||
ASHRAE_Reserved_Fmt,
|
||||
Vendor_Proprietary_Fmt),
|
||||
NULL));
|
||||
break;
|
||||
case BACAPP_TYPE_ABORT:
|
||||
bacapp_invoke_id = tvb_get_guint8(tvb, offset + 1);
|
||||
|
@ -10765,16 +10776,16 @@ dissect_bacapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
Vendor_Proprietary_Fmt), bacapp_invoke_id);
|
||||
|
||||
updateBacnetInfoValue(BACINFO_INVOKEID,
|
||||
ep_strdup_printf("Invoke ID: %d", bacapp_invoke_id));
|
||||
wmem_strdup_printf(wmem_packet_scope(), "Invoke ID: %d", bacapp_invoke_id));
|
||||
|
||||
updateBacnetInfoValue(BACINFO_SERVICE,
|
||||
ep_strconcat(abortstr,
|
||||
val_to_split_str(bacapp_reason,
|
||||
64,
|
||||
BACnetAbortReason,
|
||||
ASHRAE_Reserved_Fmt,
|
||||
Vendor_Proprietary_Fmt),
|
||||
NULL));
|
||||
wmem_strconcat(wmem_packet_scope(), abortstr,
|
||||
val_to_split_str(bacapp_reason,
|
||||
64,
|
||||
BACnetAbortReason,
|
||||
ASHRAE_Reserved_Fmt,
|
||||
Vendor_Proprietary_Fmt),
|
||||
NULL));
|
||||
break;
|
||||
/* UNKNOWN */
|
||||
default:
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <epan/prefs.h>
|
||||
#include <epan/tap.h>
|
||||
#include <epan/addr_resolv.h>
|
||||
#include <epan/wmem/wmem.h>
|
||||
|
||||
/* Start content from packet-bat.h */
|
||||
#define BAT_BATMAN_PORT 4305
|
||||
|
@ -240,7 +241,7 @@ static int dissect_bat_batman_v5(tvbuff_t *tvb, int offset, packet_info *pinfo,
|
|||
|
||||
tvbuff_t *next_tvb;
|
||||
|
||||
batman_packeth = ep_new(struct batman_packet_v5);
|
||||
batman_packeth = wmem_new(wmem_packet_scope(), struct batman_packet_v5);
|
||||
|
||||
batman_packeth->version = tvb_get_guint8(tvb, offset+0);
|
||||
batman_packeth->flags = tvb_get_guint8(tvb, offset+1);
|
||||
|
@ -366,7 +367,7 @@ static void dissect_bat_gw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
gint length_remaining;
|
||||
int offset = 0;
|
||||
|
||||
gw_packeth = ep_new(struct gw_packet);
|
||||
gw_packeth = wmem_new(wmem_packet_scope(), struct gw_packet);
|
||||
gw_packeth->type = tvb_get_guint8(tvb, 0);
|
||||
|
||||
switch (gw_packeth->type) {
|
||||
|
@ -467,7 +468,7 @@ static void dissect_bat_vis_v22(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
|
|||
gint length_remaining, i;
|
||||
int offset = 0;
|
||||
|
||||
vis_packeth = ep_new(struct vis_packet_v22);
|
||||
vis_packeth = wmem_new(wmem_packet_scope(), struct vis_packet_v22);
|
||||
|
||||
sender_ip_addr = tvb_get_ptr(tvb, 0, 4);
|
||||
sender_ip = tvb_get_ipv4(tvb, 0);
|
||||
|
@ -549,7 +550,7 @@ static void dissect_vis_entry_v22(tvbuff_t *tvb, packet_info *pinfo _U_, proto_t
|
|||
const guint8 *ip_addr;
|
||||
guint32 ip;
|
||||
|
||||
vis_datah = ep_new(struct vis_data_v22);
|
||||
vis_datah = wmem_new(wmem_packet_scope(), struct vis_data_v22);
|
||||
vis_datah->type = tvb_get_guint8(tvb, 0);
|
||||
vis_datah->data = tvb_get_ntohs(tvb, 1);
|
||||
ip_addr = tvb_get_ptr(tvb, 3, 4);
|
||||
|
@ -600,7 +601,7 @@ static void dissect_bat_vis_v23(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
|
|||
gint length_remaining, i;
|
||||
int offset = 0;
|
||||
|
||||
vis_packeth = ep_new(struct vis_packet_v23);
|
||||
vis_packeth = wmem_new(wmem_packet_scope(), struct vis_packet_v23);
|
||||
|
||||
sender_ip_addr = tvb_get_ptr(tvb, 0, 4);
|
||||
sender_ip = tvb_get_ipv4(tvb, 0);
|
||||
|
@ -682,7 +683,7 @@ static void dissect_vis_entry_v23(tvbuff_t *tvb, packet_info *pinfo _U_, proto_t
|
|||
const guint8 *ip_addr;
|
||||
guint32 ip;
|
||||
|
||||
vis_datah = ep_new(struct vis_data_v23);
|
||||
vis_datah = wmem_new(wmem_packet_scope(), struct vis_data_v23);
|
||||
vis_datah->type = tvb_get_guint8(tvb, 0);
|
||||
vis_datah->data = tvb_get_guint8(tvb, 1);
|
||||
ip_addr = tvb_get_ptr(tvb, 2, 4);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <epan/tap.h>
|
||||
#include <epan/addr_resolv.h>
|
||||
#include <epan/reassemble.h>
|
||||
#include <epan/wmem/wmem.h>
|
||||
|
||||
/* Start content from packet-batadv.h */
|
||||
#define ETH_P_BATMAN 0x4305
|
||||
|
@ -723,7 +724,7 @@ static int dissect_batadv_batman_v5(tvbuff_t *tvb, int offset, packet_info *pinf
|
|||
|
||||
tvbuff_t *next_tvb;
|
||||
|
||||
batman_packeth = (struct batman_packet_v5 *)ep_alloc(sizeof(struct batman_packet_v5));
|
||||
batman_packeth = (struct batman_packet_v5 *)wmem_alloc(wmem_packet_scope(), sizeof(struct batman_packet_v5));
|
||||
|
||||
type = tvb_get_guint8(tvb, offset+0);
|
||||
batman_packeth->version = tvb_get_guint8(tvb, offset+1);
|
||||
|
@ -833,7 +834,7 @@ static int dissect_batadv_batman_v7(tvbuff_t *tvb, int offset, packet_info *pinf
|
|||
|
||||
tvbuff_t *next_tvb;
|
||||
|
||||
batman_packeth = (struct batman_packet_v7 *)ep_alloc(sizeof(struct batman_packet_v7));
|
||||
batman_packeth = (struct batman_packet_v7 *)wmem_alloc(wmem_packet_scope(), sizeof(struct batman_packet_v7));
|
||||
|
||||
type = tvb_get_guint8(tvb, offset+0);
|
||||
batman_packeth->version = tvb_get_guint8(tvb, offset+1);
|
||||
|
@ -934,7 +935,7 @@ static int dissect_batadv_batman_v9(tvbuff_t *tvb, int offset, packet_info *pinf
|
|||
|
||||
tvbuff_t *next_tvb;
|
||||
|
||||
batman_packeth = (struct batman_packet_v9 *)ep_alloc(sizeof(struct batman_packet_v9));
|
||||
batman_packeth = (struct batman_packet_v9 *)wmem_alloc(wmem_packet_scope(), sizeof(struct batman_packet_v9));
|
||||
|
||||
type = tvb_get_guint8(tvb, offset+0);
|
||||
batman_packeth->version = tvb_get_guint8(tvb, offset+1);
|
||||
|
@ -1044,7 +1045,7 @@ static int dissect_batadv_batman_v10(tvbuff_t *tvb, int offset, packet_info *pin
|
|||
|
||||
tvbuff_t *next_tvb;
|
||||
|
||||
batman_packeth = (struct batman_packet_v10 *)ep_alloc(sizeof(struct batman_packet_v10));
|
||||
batman_packeth = (struct batman_packet_v10 *)wmem_alloc(wmem_packet_scope(), sizeof(struct batman_packet_v10));
|
||||
|
||||
type = tvb_get_guint8(tvb, offset+0);
|
||||
batman_packeth->version = tvb_get_guint8(tvb, offset+1);
|
||||
|
@ -1154,7 +1155,7 @@ static int dissect_batadv_batman_v11(tvbuff_t *tvb, int offset, packet_info *pin
|
|||
|
||||
tvbuff_t *next_tvb;
|
||||
|
||||
batman_packeth = (struct batman_packet_v11 *)ep_alloc(sizeof(struct batman_packet_v11));
|
||||
batman_packeth = (struct batman_packet_v11 *)wmem_alloc(wmem_packet_scope(), sizeof(struct batman_packet_v11));
|
||||
|
||||
type = tvb_get_guint8(tvb, offset+0);
|
||||
batman_packeth->version = tvb_get_guint8(tvb, offset+1);
|
||||
|
@ -1257,7 +1258,7 @@ static int dissect_batadv_batman_v14(tvbuff_t *tvb, int offset, packet_info *pin
|
|||
tvbuff_t *next_tvb;
|
||||
gint length_remaining;
|
||||
|
||||
batman_packeth = (struct batman_packet_v14 *)ep_alloc(sizeof(struct batman_packet_v14));
|
||||
batman_packeth = (struct batman_packet_v14 *)wmem_alloc(wmem_packet_scope(), sizeof(struct batman_packet_v14));
|
||||
|
||||
type = tvb_get_guint8(tvb, offset+0);
|
||||
batman_packeth->version = tvb_get_guint8(tvb, offset+1);
|
||||
|
@ -1433,7 +1434,7 @@ static void dissect_batadv_bcast_v6(tvbuff_t *tvb, packet_info *pinfo, proto_tre
|
|||
int offset = 0;
|
||||
proto_tree *batadv_bcast_tree = NULL;
|
||||
|
||||
bcast_packeth = (struct bcast_packet_v6 *)ep_alloc(sizeof(struct bcast_packet_v6));
|
||||
bcast_packeth = (struct bcast_packet_v6 *)wmem_alloc(wmem_packet_scope(), sizeof(struct bcast_packet_v6));
|
||||
|
||||
bcast_packeth->version = tvb_get_guint8(tvb, 1);
|
||||
orig_addr = tvb_get_ptr(tvb, 2, 6);
|
||||
|
@ -1497,7 +1498,7 @@ static void dissect_batadv_bcast_v10(tvbuff_t *tvb, packet_info *pinfo, proto_tr
|
|||
int offset = 0;
|
||||
proto_tree *batadv_bcast_tree = NULL;
|
||||
|
||||
bcast_packeth = (struct bcast_packet_v10 *)ep_alloc(sizeof(struct bcast_packet_v10));
|
||||
bcast_packeth = (struct bcast_packet_v10 *)wmem_alloc(wmem_packet_scope(), sizeof(struct bcast_packet_v10));
|
||||
|
||||
bcast_packeth->version = tvb_get_guint8(tvb, 1);
|
||||
orig_addr = tvb_get_ptr(tvb, 2, 6);
|
||||
|
@ -1566,7 +1567,7 @@ static void dissect_batadv_bcast_v14(tvbuff_t *tvb, packet_info *pinfo, proto_tr
|
|||
int offset = 0;
|
||||
proto_tree *batadv_bcast_tree = NULL;
|
||||
|
||||
bcast_packeth = (struct bcast_packet_v14 *)ep_alloc(sizeof(struct bcast_packet_v14));
|
||||
bcast_packeth = (struct bcast_packet_v14 *)wmem_alloc(wmem_packet_scope(), sizeof(struct bcast_packet_v14));
|
||||
|
||||
bcast_packeth->version = tvb_get_guint8(tvb, 1);
|
||||
bcast_packeth->ttl = tvb_get_guint8(tvb, 2);
|
||||
|
@ -1670,7 +1671,7 @@ static void dissect_batadv_icmp_v6(tvbuff_t *tvb, packet_info *pinfo, proto_tree
|
|||
int offset = 0;
|
||||
proto_tree *batadv_icmp_tree = NULL;
|
||||
|
||||
icmp_packeth = (struct icmp_packet_v6 *)ep_alloc(sizeof(struct icmp_packet_v6));
|
||||
icmp_packeth = (struct icmp_packet_v6 *)wmem_alloc(wmem_packet_scope(), sizeof(struct icmp_packet_v6));
|
||||
|
||||
icmp_packeth->version = tvb_get_guint8(tvb, 1);
|
||||
icmp_packeth->msg_type = tvb_get_guint8(tvb, 2);
|
||||
|
@ -1779,7 +1780,7 @@ static void dissect_batadv_icmp_v7(tvbuff_t *tvb, packet_info *pinfo, proto_tree
|
|||
gint length_remaining;
|
||||
int offset = 0;
|
||||
|
||||
icmp_packeth = (struct icmp_packet_v7 *)ep_alloc(sizeof(struct icmp_packet_v7));
|
||||
icmp_packeth = (struct icmp_packet_v7 *)wmem_alloc(wmem_packet_scope(), sizeof(struct icmp_packet_v7));
|
||||
|
||||
icmp_packeth->version = tvb_get_guint8(tvb, 1);
|
||||
icmp_packeth->msg_type = tvb_get_guint8(tvb, 2);
|
||||
|
@ -1867,7 +1868,7 @@ static void dissect_batadv_icmp_v14(tvbuff_t *tvb, packet_info *pinfo, proto_tre
|
|||
gint length_remaining;
|
||||
int offset = 0;
|
||||
|
||||
icmp_packeth = (struct icmp_packet_v14 *)ep_alloc(sizeof(struct icmp_packet_v14));
|
||||
icmp_packeth = (struct icmp_packet_v14 *)wmem_alloc(wmem_packet_scope(), sizeof(struct icmp_packet_v14));
|
||||
|
||||
icmp_packeth->version = tvb_get_guint8(tvb, 1);
|
||||
icmp_packeth->ttl = tvb_get_guint8(tvb, 2);
|
||||
|
@ -1987,7 +1988,7 @@ static void dissect_batadv_unicast_v6(tvbuff_t *tvb, packet_info *pinfo, proto_t
|
|||
int offset = 0;
|
||||
proto_tree *batadv_unicast_tree = NULL;
|
||||
|
||||
unicast_packeth = (struct unicast_packet_v6 *)ep_alloc(sizeof(struct unicast_packet_v6));
|
||||
unicast_packeth = (struct unicast_packet_v6 *)wmem_alloc(wmem_packet_scope(), sizeof(struct unicast_packet_v6));
|
||||
|
||||
unicast_packeth->version = tvb_get_guint8(tvb, 1);
|
||||
dest_addr = tvb_get_ptr(tvb, 2, 6);
|
||||
|
@ -2052,7 +2053,7 @@ static void dissect_batadv_unicast_v14(tvbuff_t *tvb, packet_info *pinfo, proto_
|
|||
int offset = 0;
|
||||
proto_tree *batadv_unicast_tree = NULL;
|
||||
|
||||
unicast_packeth = (struct unicast_packet_v14 *)ep_alloc(sizeof(struct unicast_packet_v14));
|
||||
unicast_packeth = (struct unicast_packet_v14 *)wmem_alloc(wmem_packet_scope(), sizeof(struct unicast_packet_v14));
|
||||
|
||||
unicast_packeth->version = tvb_get_guint8(tvb, 1);
|
||||
unicast_packeth->ttl = tvb_get_guint8(tvb, 2);
|
||||
|
@ -2140,7 +2141,7 @@ static void dissect_batadv_unicast_4addr_v14(tvbuff_t *tvb, packet_info *pinfo,
|
|||
int offset = 0;
|
||||
proto_tree *batadv_unicast_4addr_tree = NULL;
|
||||
|
||||
unicast_4addr_packeth = (struct unicast_4addr_packet_v14 *)ep_alloc(sizeof(struct unicast_4addr_packet_v14));
|
||||
unicast_4addr_packeth = (struct unicast_4addr_packet_v14 *)wmem_alloc(wmem_packet_scope(), sizeof(struct unicast_4addr_packet_v14));
|
||||
|
||||
unicast_4addr_packeth->version = tvb_get_guint8(tvb, 1);
|
||||
unicast_4addr_packeth->ttl = tvb_get_guint8(tvb, 2);
|
||||
|
@ -2248,7 +2249,7 @@ static void dissect_batadv_unicast_frag_v12(tvbuff_t *tvb, packet_info *pinfo, p
|
|||
int head = 0;
|
||||
gint length_remaining;
|
||||
|
||||
unicast_frag_packeth = (struct unicast_frag_packet_v12 *)ep_alloc(sizeof(struct unicast_frag_packet_v12));
|
||||
unicast_frag_packeth = (struct unicast_frag_packet_v12 *)wmem_alloc(wmem_packet_scope(), sizeof(struct unicast_frag_packet_v12));
|
||||
|
||||
unicast_frag_packeth->version = tvb_get_guint8(tvb, 1);
|
||||
dest_addr = tvb_get_ptr(tvb, 2, 6);
|
||||
|
@ -2354,7 +2355,7 @@ static void dissect_batadv_unicast_frag_v14(tvbuff_t *tvb, packet_info *pinfo, p
|
|||
int head = 0;
|
||||
gint length_remaining;
|
||||
|
||||
unicast_frag_packeth = (struct unicast_frag_packet_v14 *)ep_alloc(sizeof(struct unicast_frag_packet_v14));
|
||||
unicast_frag_packeth = (struct unicast_frag_packet_v14 *)wmem_alloc(wmem_packet_scope(), sizeof(struct unicast_frag_packet_v14));
|
||||
|
||||
unicast_frag_packeth->version = tvb_get_guint8(tvb, 1);
|
||||
unicast_frag_packeth->ttl = tvb_get_guint8(tvb, 2);
|
||||
|
@ -2496,7 +2497,7 @@ static void dissect_batadv_vis_v6(tvbuff_t *tvb, packet_info *pinfo, proto_tree
|
|||
gint length_remaining;
|
||||
int offset = 0, i;
|
||||
|
||||
vis_packeth = (struct vis_packet_v6 *)ep_alloc(sizeof(struct vis_packet_v6));
|
||||
vis_packeth = (struct vis_packet_v6 *)wmem_alloc(wmem_packet_scope(), sizeof(struct vis_packet_v6));
|
||||
|
||||
vis_packeth->version = tvb_get_guint8(tvb, 1);
|
||||
vis_packeth->vis_type = tvb_get_guint8(tvb, 2);
|
||||
|
@ -2624,7 +2625,7 @@ static void dissect_batadv_vis_v10(tvbuff_t *tvb, packet_info *pinfo, proto_tree
|
|||
gint length_remaining;
|
||||
int offset = 0, i;
|
||||
|
||||
vis_packeth = (struct vis_packet_v10 *)ep_alloc(sizeof(struct vis_packet_v10));
|
||||
vis_packeth = (struct vis_packet_v10 *)wmem_alloc(wmem_packet_scope(), sizeof(struct vis_packet_v10));
|
||||
|
||||
vis_packeth->version = tvb_get_guint8(tvb, 1);
|
||||
vis_packeth->vis_type = tvb_get_guint8(tvb, 2);
|
||||
|
@ -2728,7 +2729,7 @@ static void dissect_batadv_vis_v14(tvbuff_t *tvb, packet_info *pinfo, proto_tree
|
|||
gint length_remaining;
|
||||
int offset = 0, i;
|
||||
|
||||
vis_packeth = (struct vis_packet_v14 *)ep_alloc(sizeof(struct vis_packet_v14));
|
||||
vis_packeth = (struct vis_packet_v14 *)wmem_alloc(wmem_packet_scope(), sizeof(struct vis_packet_v14));
|
||||
|
||||
vis_packeth->version = tvb_get_guint8(tvb, 1);
|
||||
vis_packeth->ttl = tvb_get_guint8(tvb, 2);
|
||||
|
@ -2907,7 +2908,7 @@ static void dissect_batadv_tt_query_v14(tvbuff_t *tvb, packet_info *pinfo _U_, p
|
|||
int offset = 0, i;
|
||||
int tt_type;
|
||||
|
||||
tt_query_packeth = (struct tt_query_packet_v14 *)ep_alloc(sizeof(struct tt_query_packet_v14));
|
||||
tt_query_packeth = (struct tt_query_packet_v14 *)wmem_alloc(wmem_packet_scope(), sizeof(struct tt_query_packet_v14));
|
||||
|
||||
tt_query_packeth->version = tvb_get_guint8(tvb, 1);
|
||||
tt_query_packeth->ttl = tvb_get_guint8(tvb, 2);
|
||||
|
@ -3083,7 +3084,7 @@ static void dissect_batadv_roam_adv_v14(tvbuff_t *tvb, packet_info *pinfo, proto
|
|||
gint length_remaining;
|
||||
int offset = 0;
|
||||
|
||||
roam_adv_packeth = (struct roam_adv_packet_v14 *)ep_alloc(sizeof(struct roam_adv_packet_v14));
|
||||
roam_adv_packeth = (struct roam_adv_packet_v14 *)wmem_alloc(wmem_packet_scope(), sizeof(struct roam_adv_packet_v14));
|
||||
|
||||
roam_adv_packeth->version = tvb_get_guint8(tvb, 1);
|
||||
roam_adv_packeth->ttl = tvb_get_guint8(tvb, 2);
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
#include <epan/expert.h>
|
||||
#include <epan/uat.h>
|
||||
#include <epan/asn1.h>
|
||||
#include <epan/wmem/wmem.h>
|
||||
|
||||
#include "packet-ber.h"
|
||||
|
||||
|
@ -4611,7 +4612,7 @@ dissect_ber_UTCTime(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, t
|
|||
}
|
||||
|
||||
if ((len < 10) || (len > 19)) {
|
||||
error_str = ep_strdup_printf("BER Error: UTCTime invalid length: %u", len);
|
||||
error_str = wmem_strdup_printf(wmem_packet_scope(), "BER Error: UTCTime invalid length: %u", len);
|
||||
instr = tvb_get_ephemeral_string(tvb, offset, len > 19 ? 19 : len);
|
||||
goto malformed;
|
||||
}
|
||||
|
@ -4675,15 +4676,16 @@ dissect_ber_UTCTime(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, t
|
|||
i+=5;
|
||||
break;
|
||||
default:
|
||||
error_str = ep_strdup_printf("BER Error: malformed UTCTime encoding, "
|
||||
"unexpected character in %dth octet, "
|
||||
"must be \'Z\', \'+\' or \'-\'", i+1);
|
||||
error_str = wmem_strdup_printf(wmem_packet_scope(),
|
||||
"BER Error: malformed UTCTime encoding, "
|
||||
"unexpected character in %dth octet, "
|
||||
"must be \'Z\', \'+\' or \'-\'", i+1);
|
||||
goto malformed;
|
||||
break;
|
||||
}
|
||||
|
||||
if (len != i) {
|
||||
error_str = ep_strdup_printf(
|
||||
error_str = wmem_strdup_printf(wmem_packet_scope(),
|
||||
"BER Error: malformed UTCTime encoding, %d unexpected character%s after %dth octet",
|
||||
len - i,
|
||||
(len == (i - 1) ? "s" : ""),
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
#include <epan/show_exception.h>
|
||||
#include <epan/afn.h>
|
||||
#include <epan/prefs.h>
|
||||
#include <epan/emem.h>
|
||||
#include <epan/wmem/wmem.h>
|
||||
#include <epan/expert.h>
|
||||
#include <epan/etypes.h>
|
||||
#include <packet-ip.h>
|
||||
|
@ -1206,30 +1206,30 @@ static char*
|
|||
decode_bgp_rd(tvbuff_t *tvb, gint offset)
|
||||
{
|
||||
guint16 rd_type;
|
||||
emem_strbuf_t *strbuf;
|
||||
wmem_strbuf_t *strbuf;
|
||||
|
||||
rd_type = tvb_get_ntohs(tvb,offset);
|
||||
strbuf = ep_strbuf_new_label(NULL);
|
||||
strbuf = wmem_strbuf_new_label(wmem_packet_scope());
|
||||
|
||||
switch (rd_type) {
|
||||
case FORMAT_AS2_LOC:
|
||||
ep_strbuf_printf(strbuf, "%u:%u", tvb_get_ntohs(tvb, offset + 2),
|
||||
tvb_get_ntohl(tvb, offset + 4));
|
||||
wmem_strbuf_append_printf(strbuf, "%u:%u", tvb_get_ntohs(tvb, offset + 2),
|
||||
tvb_get_ntohl(tvb, offset + 4));
|
||||
break;
|
||||
case FORMAT_IP_LOC:
|
||||
ep_strbuf_printf(strbuf, "%s:%u", tvb_ip_to_str(tvb, offset + 2),
|
||||
tvb_get_ntohs(tvb, offset + 6));
|
||||
wmem_strbuf_append_printf(strbuf, "%s:%u", tvb_ip_to_str(tvb, offset + 2),
|
||||
tvb_get_ntohs(tvb, offset + 6));
|
||||
break ;
|
||||
case FORMAT_AS4_LOC:
|
||||
ep_strbuf_printf(strbuf, "%u:%u", tvb_get_ntohl(tvb, offset + 2),
|
||||
tvb_get_ntohs(tvb, offset + 6));
|
||||
wmem_strbuf_append_printf(strbuf, "%u:%u", tvb_get_ntohl(tvb, offset + 2),
|
||||
tvb_get_ntohs(tvb, offset + 6));
|
||||
break ;
|
||||
default:
|
||||
ep_strbuf_printf(strbuf, "Unknown (0x%04x) RD type",rd_type);
|
||||
wmem_strbuf_append_printf(strbuf, "Unknown (0x%04x) RD type",rd_type);
|
||||
break;
|
||||
} /* switch (rd_type) */
|
||||
|
||||
return strbuf->str;
|
||||
return (char*)wmem_strbuf_get_str(strbuf);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1878,7 +1878,7 @@ decode_mdt_safi(proto_tree *tree, tvbuff_t *tvb, gint offset)
|
|||
* argument.
|
||||
*/
|
||||
static guint
|
||||
decode_MPLS_stack(tvbuff_t *tvb, gint offset, emem_strbuf_t *stack_strbuf)
|
||||
decode_MPLS_stack(tvbuff_t *tvb, gint offset, wmem_strbuf_t *stack_strbuf)
|
||||
{
|
||||
guint32 label_entry; /* an MPLS label enrty (label + COS field + stack bit */
|
||||
gint indx; /* index for the label stack */
|
||||
|
@ -1886,7 +1886,7 @@ decode_MPLS_stack(tvbuff_t *tvb, gint offset, emem_strbuf_t *stack_strbuf)
|
|||
indx = offset ;
|
||||
label_entry = 0x000000 ;
|
||||
|
||||
ep_strbuf_truncate(stack_strbuf, 0);
|
||||
wmem_strbuf_truncate(stack_strbuf, 0);
|
||||
|
||||
while ((label_entry & 0x000001) == 0) {
|
||||
|
||||
|
@ -1894,18 +1894,18 @@ decode_MPLS_stack(tvbuff_t *tvb, gint offset, emem_strbuf_t *stack_strbuf)
|
|||
|
||||
/* withdrawn routes may contain 0 or 0x800000 in the first label */
|
||||
if((indx-offset)==0&&(label_entry==0||label_entry==0x800000)) {
|
||||
ep_strbuf_append(stack_strbuf, "0 (withdrawn)");
|
||||
wmem_strbuf_append(stack_strbuf, "0 (withdrawn)");
|
||||
return (1);
|
||||
}
|
||||
|
||||
ep_strbuf_append_printf(stack_strbuf, "%u%s", label_entry >> 4,
|
||||
wmem_strbuf_append_printf(stack_strbuf, "%u%s", label_entry >> 4,
|
||||
((label_entry & 0x000001) == 0) ? "," : " (bottom)");
|
||||
|
||||
indx += 3 ;
|
||||
|
||||
if ((label_entry & 0x000001) == 0) {
|
||||
/* real MPLS multi-label stack in BGP? - maybe later; for now, it must be a bogus packet */
|
||||
ep_strbuf_append(stack_strbuf, " (BOGUS: Bottom of Stack NOT set!)");
|
||||
wmem_strbuf_append(stack_strbuf, " (BOGUS: Bottom of Stack NOT set!)");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1918,7 +1918,7 @@ decode_MPLS_stack(tvbuff_t *tvb, gint offset, emem_strbuf_t *stack_strbuf)
|
|||
*/
|
||||
|
||||
static int
|
||||
mp_addr_to_str (guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, emem_strbuf_t *strbuf, gint nhlen)
|
||||
mp_addr_to_str (guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, wmem_strbuf_t *strbuf, gint nhlen)
|
||||
{
|
||||
int length; /* length of the address in byte */
|
||||
guint32 ip4addr,ip4addr2; /* IPv4 address */
|
||||
|
@ -1937,62 +1937,65 @@ mp_addr_to_str (guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, emem_strbu
|
|||
/* RTF NHop can be IPv4 or IPv6. They are differentiated by length of the field*/
|
||||
length = nhlen;
|
||||
if (nhlen == 4) {
|
||||
ep_strbuf_append(strbuf, tvb_ip_to_str(tvb, offset));
|
||||
wmem_strbuf_append(strbuf, tvb_ip_to_str(tvb, offset));
|
||||
} else if (nhlen == 16) {
|
||||
ep_strbuf_append(strbuf, tvb_ip6_to_str(tvb, offset));
|
||||
wmem_strbuf_append(strbuf, tvb_ip6_to_str(tvb, offset));
|
||||
} else {
|
||||
ep_strbuf_append(strbuf, "Unknown address");
|
||||
wmem_strbuf_append(strbuf, "Unknown address");
|
||||
}
|
||||
break;
|
||||
case SAFNUM_TUNNEL:
|
||||
length = 4 ;
|
||||
ip4addr = tvb_get_ipv4(tvb, offset);
|
||||
ep_strbuf_append(strbuf, ip_to_str((guint8 *)&ip4addr));
|
||||
wmem_strbuf_append(strbuf, ip_to_str((guint8 *)&ip4addr));
|
||||
break;
|
||||
case SAFNUM_LAB_VPNUNICAST:
|
||||
case SAFNUM_LAB_VPNMULCAST:
|
||||
case SAFNUM_LAB_VPNUNIMULC:
|
||||
rd_type=tvb_get_ntohs(tvb,offset) ;
|
||||
wmem_strbuf_truncate(strbuf, 0);
|
||||
switch (rd_type) {
|
||||
case FORMAT_AS2_LOC:
|
||||
length = 8 + sizeof(ip4addr);
|
||||
ip4addr = tvb_get_ipv4(tvb, offset + 8); /* Next Hop */
|
||||
ep_strbuf_printf(strbuf, "Empty Label Stack RD=%u:%u IPv4=%s",
|
||||
tvb_get_ntohs(tvb, offset + 2),
|
||||
tvb_get_ntohl(tvb, offset + 4),
|
||||
ip_to_str((guint8 *)&ip4addr));
|
||||
wmem_strbuf_append_printf(strbuf, "Empty Label Stack RD=%u:%u IPv4=%s",
|
||||
tvb_get_ntohs(tvb, offset + 2),
|
||||
tvb_get_ntohl(tvb, offset + 4),
|
||||
ip_to_str((guint8 *)&ip4addr));
|
||||
break;
|
||||
case FORMAT_IP_LOC:
|
||||
length = 8 + sizeof(ip4addr);
|
||||
ip4addr = tvb_get_ipv4(tvb, offset + 2); /* IP part of the RD */
|
||||
ip4addr2 = tvb_get_ipv4(tvb, offset + 8); /* Next Hop */
|
||||
ep_strbuf_printf(strbuf, "Empty Label Stack RD=%s:%u IPv4=%s",
|
||||
ip_to_str((guint8 *)&ip4addr),
|
||||
tvb_get_ntohs(tvb, offset + 6),
|
||||
ip_to_str((guint8 *)&ip4addr2));
|
||||
wmem_strbuf_append_printf(strbuf, "Empty Label Stack RD=%s:%u IPv4=%s",
|
||||
ip_to_str((guint8 *)&ip4addr),
|
||||
tvb_get_ntohs(tvb, offset + 6),
|
||||
ip_to_str((guint8 *)&ip4addr2));
|
||||
break ;
|
||||
case FORMAT_AS4_LOC:
|
||||
length = 8 + sizeof(ip4addr);
|
||||
ip4addr = tvb_get_ipv4(tvb, offset + 8); /* Next Hop */
|
||||
ep_strbuf_printf(strbuf, "Empty Label Stack RD=%u.%u:%u IPv4=%s",
|
||||
tvb_get_ntohs(tvb, offset + 2),
|
||||
tvb_get_ntohs(tvb, offset + 4),
|
||||
tvb_get_ntohs(tvb, offset + 6),
|
||||
ip_to_str((guint8 *)&ip4addr));
|
||||
wmem_strbuf_append_printf(strbuf, "Empty Label Stack RD=%u.%u:%u IPv4=%s",
|
||||
tvb_get_ntohs(tvb, offset + 2),
|
||||
tvb_get_ntohs(tvb, offset + 4),
|
||||
tvb_get_ntohs(tvb, offset + 6),
|
||||
ip_to_str((guint8 *)&ip4addr));
|
||||
break ;
|
||||
default:
|
||||
length = 0 ;
|
||||
ep_strbuf_printf(strbuf, "Unknown (0x%04x) labeled VPN IPv4 address format",rd_type);
|
||||
wmem_strbuf_append_printf(strbuf, "Unknown (0x%04x) labeled VPN IPv4 address format",rd_type);
|
||||
break;
|
||||
} /* switch (rd_type) */
|
||||
break;
|
||||
default:
|
||||
length = 0 ;
|
||||
ep_strbuf_printf(strbuf, "Unknown SAFI (%u) for AFI %u", safi, afi);
|
||||
wmem_strbuf_truncate(strbuf, 0);
|
||||
wmem_strbuf_append_printf(strbuf, "Unknown SAFI (%u) for AFI %u", safi, afi);
|
||||
break;
|
||||
} /* switch (safi) */
|
||||
break;
|
||||
case AFNUM_INET6:
|
||||
wmem_strbuf_truncate(strbuf, 0);
|
||||
switch (safi) {
|
||||
case SAFNUM_UNICAST:
|
||||
case SAFNUM_MULCAST:
|
||||
|
@ -2002,7 +2005,7 @@ mp_addr_to_str (guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, emem_strbu
|
|||
case SAFNUM_TUNNEL:
|
||||
length = 16 ;
|
||||
tvb_get_ipv6(tvb, offset, &ip6addr);
|
||||
ep_strbuf_printf(strbuf, "%s", ip6_to_str(&ip6addr));
|
||||
wmem_strbuf_append_printf(strbuf, "%s", ip6_to_str(&ip6addr));
|
||||
break;
|
||||
case SAFNUM_LAB_VPNUNICAST:
|
||||
case SAFNUM_LAB_VPNMULCAST:
|
||||
|
@ -2012,42 +2015,43 @@ mp_addr_to_str (guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, emem_strbu
|
|||
case FORMAT_AS2_LOC:
|
||||
length = 8 + 16;
|
||||
tvb_get_ipv6(tvb, offset + 8, &ip6addr); /* Next Hop */
|
||||
ep_strbuf_printf(strbuf, "Empty Label Stack RD=%u:%u IPv6=%s",
|
||||
tvb_get_ntohs(tvb, offset + 2),
|
||||
tvb_get_ntohl(tvb, offset + 4),
|
||||
ip6_to_str(&ip6addr));
|
||||
wmem_strbuf_append_printf(strbuf, "Empty Label Stack RD=%u:%u IPv6=%s",
|
||||
tvb_get_ntohs(tvb, offset + 2),
|
||||
tvb_get_ntohl(tvb, offset + 4),
|
||||
ip6_to_str(&ip6addr));
|
||||
break;
|
||||
case FORMAT_IP_LOC:
|
||||
length = 8 + 16;
|
||||
ip4addr = tvb_get_ipv4(tvb, offset + 2); /* IP part of the RD */
|
||||
tvb_get_ipv6(tvb, offset + 8, &ip6addr); /* Next Hop */
|
||||
ep_strbuf_printf(strbuf, "Empty Label Stack RD=%s:%u IPv6=%s",
|
||||
ip_to_str((guint8 *)&ip4addr),
|
||||
tvb_get_ntohs(tvb, offset + 6),
|
||||
ip6_to_str(&ip6addr));
|
||||
wmem_strbuf_append_printf(strbuf, "Empty Label Stack RD=%s:%u IPv6=%s",
|
||||
ip_to_str((guint8 *)&ip4addr),
|
||||
tvb_get_ntohs(tvb, offset + 6),
|
||||
ip6_to_str(&ip6addr));
|
||||
break ;
|
||||
case FORMAT_AS4_LOC:
|
||||
length = 8 + 16;
|
||||
tvb_get_ipv6(tvb, offset + 8, &ip6addr); /* Next Hop */
|
||||
ep_strbuf_printf(strbuf, "Empty Label Stack RD=%u:%u IPv6=%s",
|
||||
tvb_get_ntohl(tvb, offset + 2),
|
||||
tvb_get_ntohs(tvb, offset + 6),
|
||||
ip6_to_str(&ip6addr));
|
||||
wmem_strbuf_append_printf(strbuf, "Empty Label Stack RD=%u:%u IPv6=%s",
|
||||
tvb_get_ntohl(tvb, offset + 2),
|
||||
tvb_get_ntohs(tvb, offset + 6),
|
||||
ip6_to_str(&ip6addr));
|
||||
break ;
|
||||
default:
|
||||
length = 0 ;
|
||||
ep_strbuf_printf(strbuf, "Unknown (0x%04x) labeled VPN IPv6 address format",rd_type);
|
||||
wmem_strbuf_append_printf(strbuf, "Unknown (0x%04x) labeled VPN IPv6 address format",rd_type);
|
||||
break;
|
||||
} /* switch (rd_type) */
|
||||
break;
|
||||
default:
|
||||
length = 0 ;
|
||||
ep_strbuf_printf(strbuf, "Unknown SAFI (%u) for AFI %u", safi, afi);
|
||||
wmem_strbuf_append_printf(strbuf, "Unknown SAFI (%u) for AFI %u", safi, afi);
|
||||
break;
|
||||
} /* switch (safi) */
|
||||
break;
|
||||
case AFNUM_L2VPN:
|
||||
case AFNUM_L2VPN:
|
||||
case AFNUM_L2VPN_OLD:
|
||||
wmem_strbuf_truncate(strbuf, 0);
|
||||
switch (safi) {
|
||||
case SAFNUM_LAB_VPNUNICAST: /* only labeles prefixes do make sense */
|
||||
case SAFNUM_LAB_VPNMULCAST:
|
||||
|
@ -2055,18 +2059,19 @@ mp_addr_to_str (guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, emem_strbu
|
|||
case SAFNUM_VPLS:
|
||||
length = 4; /* the next-hop is simply an ipv4 addr */
|
||||
ip4addr = tvb_get_ipv4(tvb, offset + 0);
|
||||
ep_strbuf_printf(strbuf, "IPv4=%s",
|
||||
ip_to_str((guint8 *)&ip4addr));
|
||||
wmem_strbuf_append_printf(strbuf, "IPv4=%s",
|
||||
ip_to_str((guint8 *)&ip4addr));
|
||||
break;
|
||||
default:
|
||||
length = 0 ;
|
||||
ep_strbuf_printf(strbuf, "Unknown SAFI (%u) for AFI %u", safi, afi);
|
||||
wmem_strbuf_append_printf(strbuf, "Unknown SAFI (%u) for AFI %u", safi, afi);
|
||||
break;
|
||||
} /* switch (safi) */
|
||||
break;
|
||||
default:
|
||||
length = 0 ;
|
||||
ep_strbuf_printf(strbuf, "Unknown AFI (%u) value", afi);
|
||||
wmem_strbuf_truncate(strbuf, 0);
|
||||
wmem_strbuf_append_printf(strbuf, "Unknown AFI (%u) value", afi);
|
||||
break;
|
||||
} /* switch (afi) */
|
||||
return(length) ;
|
||||
|
@ -2095,8 +2100,8 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
} ip4addr, ip4addr2; /* IPv4 address */
|
||||
struct e_in6_addr ip6addr; /* IPv6 address */
|
||||
guint16 rd_type; /* Route Distinguisher type */
|
||||
emem_strbuf_t *stack_strbuf; /* label stack */
|
||||
emem_strbuf_t *comm_strbuf;
|
||||
wmem_strbuf_t *stack_strbuf; /* label stack */
|
||||
wmem_strbuf_t *comm_strbuf;
|
||||
|
||||
switch (afi) {
|
||||
|
||||
|
@ -2113,7 +2118,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
|
||||
case SAFNUM_MPLS_LABEL:
|
||||
plen = tvb_get_guint8(tvb, offset);
|
||||
stack_strbuf = ep_strbuf_new_label(NULL);
|
||||
stack_strbuf = wmem_strbuf_new_label(wmem_packet_scope());
|
||||
labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
|
||||
|
||||
offset += (1 + labnum * 3);
|
||||
|
@ -2135,12 +2140,13 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
ti = proto_tree_add_text(tree, tvb, start_offset,
|
||||
(offset + length) - start_offset,
|
||||
"Label Stack=%s IPv4=%s/%u",
|
||||
stack_strbuf->str, ip_to_str(ip4addr.addr_bytes), plen);
|
||||
wmem_strbuf_get_str(stack_strbuf),
|
||||
ip_to_str(ip4addr.addr_bytes), plen);
|
||||
prefix_tree = proto_item_add_subtree(ti, ett_bgp_prefix);
|
||||
proto_tree_add_text(prefix_tree, tvb, start_offset, 1, "%s Prefix length: %u",
|
||||
tag, plen + labnum * 3 * 8);
|
||||
proto_tree_add_text(prefix_tree, tvb, start_offset + 1, 3 * labnum, "%s Label Stack: %s",
|
||||
tag, stack_strbuf->str);
|
||||
tag, wmem_strbuf_get_str(stack_strbuf));
|
||||
if (hf_addr4 != -1) {
|
||||
proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb, offset,
|
||||
length, ip4addr.addr);
|
||||
|
@ -2179,31 +2185,31 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
}
|
||||
|
||||
length = (plen + 7)/8;
|
||||
comm_strbuf = ep_strbuf_new_label(NULL);
|
||||
comm_strbuf = wmem_strbuf_new_label(wmem_packet_scope());
|
||||
|
||||
switch (tvb_get_ntohs(tvb, offset + 1 + 4)) {
|
||||
case BGP_EXT_COM_RT_0:
|
||||
ep_strbuf_printf(comm_strbuf, "%u:%u",
|
||||
tvb_get_ntohs(tvb, offset + 1 + 6),
|
||||
tvb_get_ntohl(tvb, offset + 1 + 8));
|
||||
wmem_strbuf_append_printf(comm_strbuf, "%u:%u",
|
||||
tvb_get_ntohs(tvb, offset + 1 + 6),
|
||||
tvb_get_ntohl(tvb, offset + 1 + 8));
|
||||
break;
|
||||
case BGP_EXT_COM_RT_1:
|
||||
ep_strbuf_printf(comm_strbuf, "%s:%u",
|
||||
tvb_ip_to_str(tvb, offset + 1 + 6),
|
||||
tvb_get_ntohs(tvb, offset + 1 + 10));
|
||||
wmem_strbuf_append_printf(comm_strbuf, "%s:%u",
|
||||
tvb_ip_to_str(tvb, offset + 1 + 6),
|
||||
tvb_get_ntohs(tvb, offset + 1 + 10));
|
||||
break;
|
||||
case BGP_EXT_COM_RT_2:
|
||||
ep_strbuf_printf(comm_strbuf, "%u:%u",
|
||||
tvb_get_ntohl(tvb, 6),
|
||||
tvb_get_ntohs(tvb, offset + 1 + 10));
|
||||
wmem_strbuf_append_printf(comm_strbuf, "%u:%u",
|
||||
tvb_get_ntohl(tvb, 6),
|
||||
tvb_get_ntohs(tvb, offset + 1 + 10));
|
||||
break;
|
||||
default:
|
||||
ep_strbuf_printf(comm_strbuf, "Invalid RT type");
|
||||
wmem_strbuf_append_printf(comm_strbuf, "Invalid RT type");
|
||||
break;
|
||||
}
|
||||
ti = proto_tree_add_text(tree, tvb, offset + 1, length, "%s %u:%s/%u",
|
||||
tag, tvb_get_ntohl(tvb, offset + 1 + 0),
|
||||
comm_strbuf->str,
|
||||
wmem_strbuf_get_str(comm_strbuf),
|
||||
plen);
|
||||
prefix_tree = proto_item_add_subtree(ti, ett_bgp_prefix);
|
||||
proto_tree_add_text(prefix_tree, tvb, offset, 1, "%s Prefix length: %u",
|
||||
|
@ -2211,7 +2217,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
proto_tree_add_text(prefix_tree, tvb, offset + 1, 4, "%s Originating AS: %u",
|
||||
tag, tvb_get_ntohl(tvb, offset + 1 + 0));
|
||||
proto_tree_add_text(prefix_tree, tvb, offset + 1 + 4, length - 4, "%s Community prefix: %s",
|
||||
tag, comm_strbuf->str);
|
||||
tag, wmem_strbuf_get_str(comm_strbuf));
|
||||
total_length = 1 + length;
|
||||
break;
|
||||
case SAFNUM_ENCAPSULATION:
|
||||
|
@ -2275,7 +2281,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
case SAFNUM_LAB_VPNMULCAST:
|
||||
case SAFNUM_LAB_VPNUNIMULC:
|
||||
plen = tvb_get_guint8(tvb, offset);
|
||||
stack_strbuf = ep_strbuf_new_label(NULL);
|
||||
stack_strbuf = wmem_strbuf_new_label(wmem_packet_scope());
|
||||
labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
|
||||
|
||||
offset += (1 + labnum * 3);
|
||||
|
@ -2310,7 +2316,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
ti = proto_tree_add_text(tree, tvb, start_offset,
|
||||
(offset + 8 + length) - start_offset,
|
||||
"Label Stack=%s RD=%u:%u, IPv4=%s/%u",
|
||||
stack_strbuf->str,
|
||||
wmem_strbuf_get_str(stack_strbuf),
|
||||
tvb_get_ntohs(tvb, offset + 2),
|
||||
tvb_get_ntohl(tvb, offset + 4),
|
||||
ip_to_str(ip4addr.addr_bytes), plen);
|
||||
|
@ -2318,7 +2324,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
proto_tree_add_text(prefix_tree, tvb, start_offset, 1, "%s Prefix length: %u",
|
||||
tag, plen + labnum * 3 * 8 + 8 * 8);
|
||||
proto_tree_add_text(prefix_tree, tvb, start_offset + 1, 3 * labnum,
|
||||
"%s Label Stack: %s", tag, stack_strbuf->str);
|
||||
"%s Label Stack: %s", tag, wmem_strbuf_get_str(stack_strbuf));
|
||||
proto_tree_add_text(prefix_tree, tvb, start_offset + 1 + 3 * labnum, 8,
|
||||
"%s Route Distinguisher: %u:%u", tag, tvb_get_ntohs(tvb, offset + 2),
|
||||
tvb_get_ntohl(tvb, offset + 4));
|
||||
|
@ -2347,7 +2353,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
ti = proto_tree_add_text(tree, tvb, start_offset,
|
||||
(offset + 8 + length) - start_offset,
|
||||
"Label Stack=%s RD=%s:%u, IPv4=%s/%u",
|
||||
stack_strbuf->str,
|
||||
wmem_strbuf_get_str(stack_strbuf),
|
||||
ip_to_str(ip4addr.addr_bytes),
|
||||
tvb_get_ntohs(tvb, offset + 6),
|
||||
ip_to_str(ip4addr2.addr_bytes),
|
||||
|
@ -2356,7 +2362,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
proto_tree_add_text(prefix_tree, tvb, start_offset, 1, "%s Prefix length: %u",
|
||||
tag, plen + labnum * 3 * 8 + 8 * 8);
|
||||
proto_tree_add_text(prefix_tree, tvb, start_offset + 1, 3 * labnum,
|
||||
"%s Label Stack: %s", tag, stack_strbuf->str);
|
||||
"%s Label Stack: %s", tag, wmem_strbuf_get_str(stack_strbuf));
|
||||
proto_tree_add_text(prefix_tree, tvb, start_offset + 1 + 3 * labnum, 8,
|
||||
"%s Route Distinguisher: %s:%u", tag, ip_to_str(ip4addr.addr_bytes),
|
||||
tvb_get_ntohs(tvb, offset + 6));
|
||||
|
@ -2383,7 +2389,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
ti = proto_tree_add_text(tree, tvb, start_offset,
|
||||
(offset + 8 + length) - start_offset,
|
||||
"Label Stack=%s RD=%u.%u:%u, IPv4=%s/%u",
|
||||
stack_strbuf->str,
|
||||
wmem_strbuf_get_str(stack_strbuf),
|
||||
tvb_get_ntohs(tvb, offset + 2),
|
||||
tvb_get_ntohs(tvb, offset + 4),
|
||||
tvb_get_ntohs(tvb, offset + 6),
|
||||
|
@ -2392,7 +2398,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
proto_tree_add_text(prefix_tree, tvb, start_offset, 1, "%s Prefix length: %u",
|
||||
tag, plen + labnum * 3 * 8 + 8 * 8);
|
||||
proto_tree_add_text(prefix_tree, tvb, start_offset + 1, 3 * labnum,
|
||||
"%s Label Stack: %s", tag, stack_strbuf->str);
|
||||
"%s Label Stack: %s", tag, wmem_strbuf_get_str(stack_strbuf));
|
||||
proto_tree_add_text(prefix_tree, tvb, start_offset + 1 + 3 * labnum, 8,
|
||||
"%s Route Distinguisher: %u.%u:%u", tag, tvb_get_ntohs(tvb, offset + 2),
|
||||
tvb_get_ntohs(tvb, offset + 4), tvb_get_ntohs(tvb, offset + 6));
|
||||
|
@ -2442,7 +2448,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
|
||||
case SAFNUM_MPLS_LABEL:
|
||||
plen = tvb_get_guint8(tvb, offset);
|
||||
stack_strbuf = ep_strbuf_new_label(NULL);
|
||||
stack_strbuf = wmem_strbuf_new_label(wmem_packet_scope());
|
||||
labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
|
||||
|
||||
offset += (1 + labnum * 3);
|
||||
|
@ -2464,7 +2470,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
proto_tree_add_text(tree, tvb, start_offset,
|
||||
(offset + length) - start_offset,
|
||||
"Label Stack=%s, IPv6=%s/%u",
|
||||
stack_strbuf->str,
|
||||
wmem_strbuf_get_str(stack_strbuf),
|
||||
ip6_to_str(&ip6addr), plen);
|
||||
total_length = (1 + labnum * 3) + length;
|
||||
break;
|
||||
|
@ -2515,7 +2521,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
case SAFNUM_LAB_VPNMULCAST:
|
||||
case SAFNUM_LAB_VPNUNIMULC:
|
||||
plen = tvb_get_guint8(tvb, offset);
|
||||
stack_strbuf = ep_strbuf_new_label(NULL);
|
||||
stack_strbuf = wmem_strbuf_new_label(wmem_packet_scope());
|
||||
labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
|
||||
|
||||
offset += (1 + labnum * 3);
|
||||
|
@ -2549,7 +2555,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
proto_tree_add_text(tree, tvb, start_offset,
|
||||
(offset + 8 + length) - start_offset,
|
||||
"Label Stack=%s RD=%u:%u, IPv6=%s/%u",
|
||||
stack_strbuf->str,
|
||||
wmem_strbuf_get_str(stack_strbuf),
|
||||
tvb_get_ntohs(tvb, offset + 2),
|
||||
tvb_get_ntohl(tvb, offset + 4),
|
||||
ip6_to_str(&ip6addr), plen);
|
||||
|
@ -2570,7 +2576,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
proto_tree_add_text(tree, tvb, start_offset,
|
||||
(offset + 8 + length) - start_offset,
|
||||
"Label Stack=%s RD=%s:%u, IPv6=%s/%u",
|
||||
stack_strbuf->str,
|
||||
wmem_strbuf_get_str(stack_strbuf),
|
||||
ip_to_str(ip4addr.addr_bytes),
|
||||
tvb_get_ntohs(tvb, offset + 6),
|
||||
ip6_to_str(&ip6addr), plen);
|
||||
|
@ -2589,7 +2595,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
proto_tree_add_text(tree, tvb, start_offset,
|
||||
(offset + 8 + length) - start_offset,
|
||||
"Label Stack=%s RD=%u.%u:%u, IPv6=%s/%u",
|
||||
stack_strbuf->str,
|
||||
wmem_strbuf_get_str(stack_strbuf),
|
||||
tvb_get_ntohs(tvb, offset + 2),
|
||||
tvb_get_ntohs(tvb, offset + 4),
|
||||
tvb_get_ntohs(tvb, offset + 6),
|
||||
|
@ -2671,7 +2677,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
ce_id=tvb_get_ntohs(tvb,offset+10);
|
||||
labblk_off=tvb_get_ntohs(tvb,offset+12);
|
||||
labblk_size=tvb_get_ntohs(tvb,offset+14);
|
||||
stack_strbuf = ep_strbuf_new_label(NULL);
|
||||
stack_strbuf = wmem_strbuf_new_label(wmem_packet_scope());
|
||||
decode_MPLS_stack(tvb, offset + 16, stack_strbuf);
|
||||
switch (rd_type) {
|
||||
|
||||
|
@ -2686,7 +2692,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
ce_id,
|
||||
labblk_off,
|
||||
labblk_size,
|
||||
stack_strbuf->str);
|
||||
wmem_strbuf_get_str(stack_strbuf));
|
||||
break;
|
||||
|
||||
case FORMAT_IP_LOC:
|
||||
|
@ -2700,7 +2706,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
ce_id,
|
||||
labblk_off,
|
||||
labblk_size,
|
||||
stack_strbuf->str);
|
||||
wmem_strbuf_get_str(stack_strbuf));
|
||||
break;
|
||||
case FORMAT_AS4_LOC:
|
||||
proto_tree_add_text(tree, tvb, offset,
|
||||
|
@ -2713,7 +2719,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
|
|||
ce_id,
|
||||
labblk_off,
|
||||
labblk_size,
|
||||
stack_strbuf->str);
|
||||
wmem_strbuf_get_str(stack_strbuf));
|
||||
break;
|
||||
default:
|
||||
proto_tree_add_text(tree, tvb, start_offset,
|
||||
|
@ -3072,10 +3078,10 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
|
|||
guint8 length; /* AS_PATH length */
|
||||
guint8 type; /* AS_PATH type */
|
||||
guint32 as_path_item; /* item in AS_PATH segment */
|
||||
emem_strbuf_t *as_path_emstr = NULL; /* AS_PATH */
|
||||
emem_strbuf_t *communities_emstr = NULL; /* COMMUNITIES */
|
||||
emem_strbuf_t *cluster_list_emstr = NULL; /* CLUSTER_LIST */
|
||||
emem_strbuf_t *junk_emstr; /* tmp */
|
||||
wmem_strbuf_t *as_path_emstr = NULL; /* AS_PATH */
|
||||
wmem_strbuf_t *communities_emstr = NULL; /* COMMUNITIES */
|
||||
wmem_strbuf_t *cluster_list_emstr = NULL; /* CLUSTER_LIST */
|
||||
wmem_strbuf_t *junk_emstr; /* tmp */
|
||||
guint32 ipaddr; /* IPv4 address */
|
||||
guint32 aggregator_as;
|
||||
guint16 ssa_type; /* SSA T + Type */
|
||||
|
@ -3093,7 +3099,7 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
|
|||
|
||||
hlen = tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
|
||||
o = BGP_HEADER_SIZE;
|
||||
junk_emstr = ep_strbuf_new_label(NULL);
|
||||
junk_emstr = wmem_strbuf_new_label(wmem_packet_scope());
|
||||
|
||||
/* check for withdrawals */
|
||||
len = tvb_get_ntohs(tvb, o);
|
||||
|
@ -3209,8 +3215,8 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
|
|||
/* "tlen * 11" (10 digits + space) should be a good estimate
|
||||
of how long the AS path string could be */
|
||||
if (as_path_emstr == NULL)
|
||||
as_path_emstr = ep_strbuf_sized_new((tlen + 1) * 11, 0);
|
||||
ep_strbuf_truncate(as_path_emstr, 0);
|
||||
as_path_emstr = wmem_strbuf_sized_new(wmem_packet_scope(), (tlen + 1) * 11, 0);
|
||||
wmem_strbuf_truncate(as_path_emstr, 0);
|
||||
|
||||
/* estimate the length of the AS number */
|
||||
if (bgpa_type == BGPTYPE_NEW_AS_PATH)
|
||||
|
@ -3253,57 +3259,60 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
|
|||
|
||||
/* snarf each AS path */
|
||||
while (q < end) {
|
||||
const gchar *str = wmem_strbuf_get_str(as_path_emstr);
|
||||
type = tvb_get_guint8(tvb, q++);
|
||||
if (as_path_emstr->len > 1 &&
|
||||
as_path_emstr->str[as_path_emstr->len - 1] != ' ')
|
||||
ep_strbuf_append_c(as_path_emstr, ' ');
|
||||
if (wmem_strbuf_get_len(as_path_emstr) > 1 &&
|
||||
str[wmem_strbuf_get_len(as_path_emstr) - 1] != ' ')
|
||||
wmem_strbuf_append_c(as_path_emstr, ' ');
|
||||
if (type == AS_SET) {
|
||||
ep_strbuf_append_c(as_path_emstr, '{');
|
||||
wmem_strbuf_append_c(as_path_emstr, '{');
|
||||
}
|
||||
else if (type == AS_CONFED_SET) {
|
||||
ep_strbuf_append_c(as_path_emstr, '[');
|
||||
wmem_strbuf_append_c(as_path_emstr, '[');
|
||||
}
|
||||
else if (type == AS_CONFED_SEQUENCE) {
|
||||
ep_strbuf_append_c(as_path_emstr, '(');
|
||||
wmem_strbuf_append_c(as_path_emstr, '(');
|
||||
}
|
||||
length = tvb_get_guint8(tvb, q++);
|
||||
|
||||
/* snarf each value in path */
|
||||
for (j = 0; j < length; j++) {
|
||||
ep_strbuf_append_printf(as_path_emstr, "%u%s",
|
||||
(asn_len == 2) ?
|
||||
tvb_get_ntohs(tvb, q) : tvb_get_ntohl(tvb, q),
|
||||
(type == AS_SET || type == AS_CONFED_SET) ?
|
||||
", " : " ");
|
||||
wmem_strbuf_append_printf(as_path_emstr, "%u%s",
|
||||
(asn_len == 2) ?
|
||||
tvb_get_ntohs(tvb, q) : tvb_get_ntohl(tvb, q),
|
||||
(type == AS_SET || type == AS_CONFED_SET) ?
|
||||
", " : " ");
|
||||
q += asn_len;
|
||||
}
|
||||
|
||||
/* cleanup end of string */
|
||||
if (type == AS_SET) {
|
||||
ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 2);
|
||||
ep_strbuf_append_c(as_path_emstr, '}');
|
||||
wmem_strbuf_truncate(as_path_emstr, wmem_strbuf_get_len(as_path_emstr) - 2);
|
||||
wmem_strbuf_append_c(as_path_emstr, '}');
|
||||
}
|
||||
else if (type == AS_CONFED_SET) {
|
||||
ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 2);
|
||||
ep_strbuf_append_c(as_path_emstr, ']');
|
||||
wmem_strbuf_truncate(as_path_emstr, wmem_strbuf_get_len(as_path_emstr) - 2);
|
||||
wmem_strbuf_append_c(as_path_emstr, ']');
|
||||
}
|
||||
else if (type == AS_CONFED_SEQUENCE) {
|
||||
ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 1);
|
||||
ep_strbuf_append_c(as_path_emstr, ')');
|
||||
wmem_strbuf_truncate(as_path_emstr, wmem_strbuf_get_len(as_path_emstr) - 1);
|
||||
wmem_strbuf_append_c(as_path_emstr, ')');
|
||||
}
|
||||
else {
|
||||
ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 1);
|
||||
wmem_strbuf_truncate(as_path_emstr, wmem_strbuf_get_len(as_path_emstr) - 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* check for empty AS_PATH */
|
||||
if (tlen == 0)
|
||||
ep_strbuf_printf(as_path_emstr, "empty");
|
||||
if (tlen == 0) {
|
||||
wmem_strbuf_truncate(as_path_emstr, 0);
|
||||
wmem_strbuf_append_printf(as_path_emstr, "empty");
|
||||
}
|
||||
|
||||
proto_item_append_text(ti_pa, ": %s", as_path_emstr->str);
|
||||
proto_item_append_text(ti_pa, ": %s", wmem_strbuf_get_str(as_path_emstr));
|
||||
|
||||
ti = proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
|
||||
"AS path: %s", as_path_emstr->str);
|
||||
"AS path: %s", wmem_strbuf_get_str(as_path_emstr));
|
||||
as_paths_tree = proto_item_add_subtree(ti, ett_bgp_as_paths);
|
||||
|
||||
/* (o + i + aoff) =
|
||||
|
@ -3317,49 +3326,50 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
|
|||
/* XXX - Can we use some g_string*() trickery instead, e.g.
|
||||
g_string_erase()? */
|
||||
while (q < end) {
|
||||
ep_strbuf_truncate(as_path_emstr, 0);
|
||||
wmem_strbuf_truncate(as_path_emstr, 0);
|
||||
type = tvb_get_guint8(tvb, q++);
|
||||
if (type == AS_SET) {
|
||||
ep_strbuf_append_c(as_path_emstr, '{');
|
||||
wmem_strbuf_append_c(as_path_emstr, '{');
|
||||
}
|
||||
else if (type == AS_CONFED_SET) {
|
||||
ep_strbuf_append_c(as_path_emstr, '[');
|
||||
wmem_strbuf_append_c(as_path_emstr, '[');
|
||||
}
|
||||
else if (type == AS_CONFED_SEQUENCE) {
|
||||
ep_strbuf_append_c(as_path_emstr, '(');
|
||||
wmem_strbuf_append_c(as_path_emstr, '(');
|
||||
}
|
||||
length = tvb_get_guint8(tvb, q++);
|
||||
|
||||
/* snarf each value in path */
|
||||
for (j = 0; j < length; j++) {
|
||||
ep_strbuf_append_printf(as_path_emstr, "%u%s",
|
||||
(asn_len == 2) ?
|
||||
tvb_get_ntohs(tvb, q) : tvb_get_ntohl(tvb, q),
|
||||
(type == AS_SET || type == AS_CONFED_SET) ? ", " : " ");
|
||||
wmem_strbuf_append_printf(as_path_emstr, "%u%s",
|
||||
(asn_len == 2) ?
|
||||
tvb_get_ntohs(tvb, q) : tvb_get_ntohl(tvb, q),
|
||||
(type == AS_SET || type == AS_CONFED_SET) ? ", " : " ");
|
||||
q += asn_len;
|
||||
}
|
||||
|
||||
/* cleanup end of string */
|
||||
if (type == AS_SET) {
|
||||
ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 2);
|
||||
ep_strbuf_append_c(as_path_emstr, '}');
|
||||
wmem_strbuf_truncate(as_path_emstr, wmem_strbuf_get_len(as_path_emstr) - 2);
|
||||
wmem_strbuf_append_c(as_path_emstr, '}');
|
||||
}
|
||||
else if (type == AS_CONFED_SET) {
|
||||
ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 2);
|
||||
ep_strbuf_append_c(as_path_emstr, ']');
|
||||
wmem_strbuf_truncate(as_path_emstr, wmem_strbuf_get_len(as_path_emstr) - 2);
|
||||
wmem_strbuf_append_c(as_path_emstr, ']');
|
||||
}
|
||||
else if (type == AS_CONFED_SEQUENCE) {
|
||||
ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 1);
|
||||
ep_strbuf_append_c(as_path_emstr, ')');
|
||||
wmem_strbuf_truncate(as_path_emstr, wmem_strbuf_get_len(as_path_emstr) - 1);
|
||||
wmem_strbuf_append_c(as_path_emstr, ')');
|
||||
}
|
||||
else {
|
||||
ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 1);
|
||||
wmem_strbuf_truncate(as_path_emstr, wmem_strbuf_get_len(as_path_emstr) - 1);
|
||||
}
|
||||
|
||||
/* length here means number of ASs, ie length * 2 bytes */
|
||||
ti = proto_tree_add_text(as_paths_tree, tvb,
|
||||
q - length * asn_len - 2,
|
||||
length * asn_len + 2, "AS path segment: %s", as_path_emstr->str);
|
||||
length * asn_len + 2, "AS path segment: %s",
|
||||
wmem_strbuf_get_str(as_path_emstr));
|
||||
as_path_tree = proto_item_add_subtree(ti, ett_bgp_as_paths);
|
||||
proto_tree_add_text(as_path_tree, tvb, q - length * asn_len - 2,
|
||||
1, "Path segment type: %s (%u)",
|
||||
|
@ -3470,32 +3480,33 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
|
|||
a good estimate of how long the communities string could
|
||||
be */
|
||||
if (communities_emstr == NULL)
|
||||
communities_emstr = ep_strbuf_sized_new((tlen + 1) * 12, 0);
|
||||
ep_strbuf_truncate(communities_emstr, 0);
|
||||
communities_emstr = wmem_strbuf_sized_new(wmem_packet_scope(), (tlen + 1) * 12, 0);
|
||||
wmem_strbuf_truncate(communities_emstr, 0);
|
||||
|
||||
/* snarf each community */
|
||||
while (q < end) {
|
||||
/* check for well-known communities */
|
||||
if (tvb_get_ntohl(tvb, q) == BGP_COMM_NO_EXPORT)
|
||||
ep_strbuf_append(communities_emstr, "NO_EXPORT ");
|
||||
wmem_strbuf_append(communities_emstr, "NO_EXPORT ");
|
||||
else if (tvb_get_ntohl(tvb, q) == BGP_COMM_NO_ADVERTISE)
|
||||
ep_strbuf_append(communities_emstr, "NO_ADVERTISE ");
|
||||
wmem_strbuf_append(communities_emstr, "NO_ADVERTISE ");
|
||||
else if (tvb_get_ntohl(tvb, q) == BGP_COMM_NO_EXPORT_SUBCONFED)
|
||||
ep_strbuf_append(communities_emstr, "NO_EXPORT_SUBCONFED ");
|
||||
wmem_strbuf_append(communities_emstr, "NO_EXPORT_SUBCONFED ");
|
||||
else {
|
||||
ep_strbuf_append_printf(communities_emstr, "%u:%u ",
|
||||
tvb_get_ntohs(tvb, q),
|
||||
tvb_get_ntohs(tvb, q + 2));
|
||||
wmem_strbuf_append_printf(communities_emstr, "%u:%u ",
|
||||
tvb_get_ntohs(tvb, q),
|
||||
tvb_get_ntohs(tvb, q + 2));
|
||||
}
|
||||
q += 4;
|
||||
}
|
||||
/* cleanup end of string */
|
||||
ep_strbuf_truncate(communities_emstr, communities_emstr->len - 1);
|
||||
wmem_strbuf_truncate(communities_emstr, wmem_strbuf_get_len(communities_emstr) - 1);
|
||||
|
||||
proto_item_append_text(ti_pa,": %s", communities_emstr->str);
|
||||
proto_item_append_text(ti_pa,": %s", wmem_strbuf_get_str(communities_emstr));
|
||||
|
||||
ti = proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
|
||||
"Communities: %s", communities_emstr ? communities_emstr->str : "<none>");
|
||||
"Communities: %s", communities_emstr ?
|
||||
wmem_strbuf_get_str(communities_emstr) : "<none>");
|
||||
communities_tree = proto_item_add_subtree(ti,
|
||||
ett_bgp_communities);
|
||||
|
||||
|
@ -3598,7 +3609,8 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
|
|||
if (j + advance > nexthop_len)
|
||||
break;
|
||||
proto_tree_add_text(subtree3, tvb,o + i + aoff + 4 + j,
|
||||
advance, "Next hop: %s (%u)", junk_emstr->str, advance);
|
||||
advance, "Next hop: %s (%u)",
|
||||
wmem_strbuf_get_str(junk_emstr), advance);
|
||||
j += advance;
|
||||
}
|
||||
break;
|
||||
|
@ -3704,21 +3716,22 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
|
|||
a good estimate of how long the cluster_list string could
|
||||
be */
|
||||
if (cluster_list_emstr == NULL)
|
||||
cluster_list_emstr = ep_strbuf_sized_new((tlen + 1) * 16, 0);
|
||||
ep_strbuf_truncate(cluster_list_emstr, 0);
|
||||
cluster_list_emstr = wmem_strbuf_sized_new(wmem_packet_scope(), (tlen + 1) * 16, 0);
|
||||
wmem_strbuf_truncate(cluster_list_emstr, 0);
|
||||
|
||||
/* snarf each cluster list */
|
||||
while (q < end) {
|
||||
ep_strbuf_append_printf(cluster_list_emstr, "%s ", tvb_ip_to_str(tvb, q));
|
||||
wmem_strbuf_append_printf(cluster_list_emstr, "%s ", tvb_ip_to_str(tvb, q));
|
||||
q += 4;
|
||||
}
|
||||
/* cleanup end of string */
|
||||
ep_strbuf_truncate(cluster_list_emstr, cluster_list_emstr->len - 1);
|
||||
wmem_strbuf_truncate(cluster_list_emstr, wmem_strbuf_get_len(cluster_list_emstr) - 1);
|
||||
|
||||
proto_item_append_text(ti_pa, ": %s", cluster_list_emstr->str);
|
||||
proto_item_append_text(ti_pa, ": %s", wmem_strbuf_get_str(cluster_list_emstr));
|
||||
|
||||
ti = proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
|
||||
"Cluster list: %s", cluster_list_emstr ? cluster_list_emstr->str : "<none>");
|
||||
"Cluster list: %s", cluster_list_emstr ?
|
||||
wmem_strbuf_get_str(cluster_list_emstr) : "<none>");
|
||||
cluster_list_tree = proto_item_add_subtree(ti,
|
||||
ett_bgp_cluster_list);
|
||||
|
||||
|
@ -3748,7 +3761,8 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
|
|||
while (q < end) {
|
||||
ext_com8 = tvb_get_guint8(tvb,q); /* handle regular types (8 bit) */
|
||||
ext_com = tvb_get_ntohs(tvb,q); /* handle extended length types (16 bit) */
|
||||
ep_strbuf_printf(junk_emstr, "%s", val_to_str(ext_com8,bgpext_com8_type,"Unknown %d"));
|
||||
wmem_strbuf_truncate(junk_emstr, 0);
|
||||
wmem_strbuf_append_printf(junk_emstr, "%s", val_to_str(ext_com8,bgpext_com8_type,"Unknown %d"));
|
||||
is_regular_type = FALSE;
|
||||
is_extended_type = FALSE;
|
||||
/* handle regular types (8 bit) */
|
||||
|
@ -3756,7 +3770,7 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
|
|||
case BGP_EXT_COM_QOS_MARK_T:
|
||||
case BGP_EXT_COM_QOS_MARK_NT:
|
||||
is_regular_type = TRUE;
|
||||
ti = proto_tree_add_text(subtree3,tvb,q,8, "%s",junk_emstr->str);
|
||||
ti = proto_tree_add_text(subtree3,tvb,q,8, "%s", wmem_strbuf_get_str(junk_emstr));
|
||||
|
||||
subtree4 = proto_item_add_subtree(ti,ett_bgp_extended_communities);
|
||||
proto_tree_add_text(subtree4, tvb, q, 1,
|
||||
|
@ -3776,7 +3790,7 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
|
|||
break;
|
||||
case BGP_EXT_COM_COS_CAP_T:
|
||||
is_regular_type = TRUE;
|
||||
ti = proto_tree_add_text(subtree3,tvb,q,8, "%s",junk_emstr->str);
|
||||
ti = proto_tree_add_text(subtree3,tvb,q,8, "%s", wmem_strbuf_get_str(junk_emstr));
|
||||
|
||||
subtree4 = proto_item_add_subtree(ti,ett_bgp_extended_communities);
|
||||
proto_tree_add_text(subtree4, tvb, q, 1,
|
||||
|
@ -3796,65 +3810,66 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
|
|||
} /* switch (ext_com8) */
|
||||
|
||||
if (!is_regular_type) {
|
||||
ep_strbuf_printf(junk_emstr, "%s", val_to_str(ext_com,bgpext_com_type,"Unknown %d"));
|
||||
wmem_strbuf_truncate(junk_emstr, 0);
|
||||
wmem_strbuf_append_printf(junk_emstr, "%s", val_to_str(ext_com,bgpext_com_type,"Unknown %d"));
|
||||
|
||||
/* handle extended length types (16 bit) */
|
||||
switch (ext_com) {
|
||||
case BGP_EXT_COM_RT_0:
|
||||
case BGP_EXT_COM_RO_0:
|
||||
is_extended_type = TRUE;
|
||||
ep_strbuf_append_printf(junk_emstr, ": %u%s%d",
|
||||
tvb_get_ntohs(tvb,q+2),":",tvb_get_ntohl(tvb,q+4));
|
||||
proto_tree_add_text(subtree3,tvb,q,8, "%s",junk_emstr->str);
|
||||
wmem_strbuf_append_printf(junk_emstr, ": %u%s%d",
|
||||
tvb_get_ntohs(tvb,q+2),":",tvb_get_ntohl(tvb,q+4));
|
||||
proto_tree_add_text(subtree3,tvb,q,8, "%s", wmem_strbuf_get_str(junk_emstr));
|
||||
break ;
|
||||
case BGP_EXT_COM_RT_1:
|
||||
case BGP_EXT_COM_RO_1:
|
||||
is_extended_type = TRUE;
|
||||
ipaddr = tvb_get_ipv4(tvb,q+2);
|
||||
ep_strbuf_append_printf(junk_emstr, ": %s%s%u",
|
||||
ip_to_str((guint8 *)&ipaddr),":",tvb_get_ntohs(tvb,q+6));
|
||||
proto_tree_add_text(subtree3,tvb,q,8, "%s",junk_emstr->str);
|
||||
wmem_strbuf_append_printf(junk_emstr, ": %s%s%u",
|
||||
ip_to_str((guint8 *)&ipaddr),":",tvb_get_ntohs(tvb,q+6));
|
||||
proto_tree_add_text(subtree3,tvb,q,8, "%s", wmem_strbuf_get_str(junk_emstr));
|
||||
break;
|
||||
case BGP_EXT_COM_RT_2:
|
||||
case BGP_EXT_COM_RO_2:
|
||||
is_extended_type = TRUE;
|
||||
ep_strbuf_append_printf(junk_emstr, ": %u.%u:%u",
|
||||
tvb_get_ntohs(tvb,q+2),tvb_get_ntohs(tvb,q+4) ,tvb_get_ntohs(tvb,q+6));
|
||||
proto_tree_add_text(subtree3,tvb,q,8, "%s",junk_emstr->str);
|
||||
wmem_strbuf_append_printf(junk_emstr, ": %u.%u:%u",
|
||||
tvb_get_ntohs(tvb,q+2),tvb_get_ntohs(tvb,q+4) ,tvb_get_ntohs(tvb,q+6));
|
||||
proto_tree_add_text(subtree3,tvb,q,8, "%s", wmem_strbuf_get_str(junk_emstr));
|
||||
break;
|
||||
case BGP_EXT_COM_VPN_ORIGIN:
|
||||
case BGP_EXT_COM_OSPF_RID:
|
||||
is_extended_type = TRUE;
|
||||
ipaddr = tvb_get_ipv4(tvb,q+2);
|
||||
ep_strbuf_append_printf(junk_emstr, ": %s", ip_to_str((guint8 *)&ipaddr));
|
||||
proto_tree_add_text(subtree3,tvb,q,8, "%s",junk_emstr->str);
|
||||
wmem_strbuf_append_printf(junk_emstr, ": %s", ip_to_str((guint8 *)&ipaddr));
|
||||
proto_tree_add_text(subtree3,tvb,q,8, "%s", wmem_strbuf_get_str(junk_emstr));
|
||||
break;
|
||||
case BGP_EXT_COM_OSPF_RTYPE:
|
||||
is_extended_type = TRUE;
|
||||
ipaddr = tvb_get_ipv4(tvb,q+2);
|
||||
ep_strbuf_append_printf(junk_emstr, ": Area: %s, Type: %s", ip_to_str((guint8 *)&ipaddr),
|
||||
val_to_str_const(tvb_get_guint8(tvb,q+6),bgpext_ospf_rtype,"Unknown"));
|
||||
wmem_strbuf_append_printf(junk_emstr, ": Area: %s, Type: %s", ip_to_str((guint8 *)&ipaddr),
|
||||
val_to_str_const(tvb_get_guint8(tvb,q+6),bgpext_ospf_rtype,"Unknown"));
|
||||
/* print OSPF Metric type if selected */
|
||||
/* always print E2 even if not external route -- receiving router should ignore */
|
||||
if ( (tvb_get_guint8(tvb,q+7)) & BGP_OSPF_RTYPE_METRIC_TYPE ) {
|
||||
ep_strbuf_append(junk_emstr, " E2");
|
||||
wmem_strbuf_append(junk_emstr, " E2");
|
||||
} else if ((tvb_get_guint8(tvb,q+6)==BGP_OSPF_RTYPE_EXT) || (tvb_get_guint8(tvb,q+6)==BGP_OSPF_RTYPE_NSSA)) {
|
||||
ep_strbuf_append(junk_emstr, " E1");
|
||||
wmem_strbuf_append(junk_emstr, " E1");
|
||||
} else {
|
||||
ep_strbuf_append(junk_emstr, ", no options");
|
||||
wmem_strbuf_append(junk_emstr, ", no options");
|
||||
}
|
||||
proto_tree_add_text(subtree3,tvb,q,8, "%s",junk_emstr->str);
|
||||
proto_tree_add_text(subtree3,tvb,q,8, "%s", wmem_strbuf_get_str(junk_emstr));
|
||||
break;
|
||||
case BGP_EXT_COM_LINKBAND:
|
||||
is_extended_type = TRUE;
|
||||
as_num = tvb_get_ntohs(tvb,q+2);
|
||||
linkband = tvb_get_ntohieee_float(tvb,q+4);
|
||||
ep_strbuf_append_printf(junk_emstr, ": ASN %u, %.3f Mbps", as_num,linkband*8/1000000);
|
||||
proto_tree_add_text(subtree3,tvb,q,8, "%s",junk_emstr->str);
|
||||
wmem_strbuf_append_printf(junk_emstr, ": ASN %u, %.3f Mbps", as_num,linkband*8/1000000);
|
||||
proto_tree_add_text(subtree3,tvb,q,8, "%s", wmem_strbuf_get_str(junk_emstr));
|
||||
break;
|
||||
case BGP_EXT_COM_L2INFO:
|
||||
is_extended_type = TRUE;
|
||||
ti = proto_tree_add_text(subtree3,tvb,q,8, "%s",junk_emstr->str);
|
||||
ti = proto_tree_add_text(subtree3,tvb,q,8, "%s", wmem_strbuf_get_str(junk_emstr));
|
||||
|
||||
subtree4 = proto_item_add_subtree(ti,ett_bgp_extended_communities);
|
||||
proto_tree_add_item(subtree4, hf_bgp_ext_com_l2_encaps,tvb,q+2, 1, ENC_BIG_ENDIAN);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <epan/packet.h>
|
||||
#include <epan/wmem/wmem.h>
|
||||
|
||||
#define PNAME "Canon BJNP"
|
||||
#define PSNAME "BJNP"
|
||||
|
@ -114,8 +115,9 @@ static int dissect_bjnp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo
|
|||
proto_tree_add_item (bjnp_tree, hf_cmd_code, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset++;
|
||||
|
||||
info = ep_strdup_printf("%s: %s",val_to_str (dev_type, dev_type_vals, "Unknown type (%d)"),
|
||||
val_to_str (cmd_code, cmd_code_vals, "Unknown code (%d)"));
|
||||
info = wmem_strdup_printf(wmem_packet_scope(), "%s: %s",
|
||||
val_to_str (dev_type, dev_type_vals, "Unknown type (%d)"),
|
||||
val_to_str (cmd_code, cmd_code_vals, "Unknown code (%d)"));
|
||||
|
||||
proto_item_append_text (ti, ", %s", info);
|
||||
col_add_str (pinfo->cinfo, COL_INFO, info);
|
||||
|
|
|
@ -124,6 +124,7 @@
|
|||
#include <epan/sminmpec.h>
|
||||
#include <epan/expert.h>
|
||||
#include <epan/uat.h>
|
||||
#include <epan/wmem/wmem.h>
|
||||
|
||||
void proto_register_bootp(void);
|
||||
void proto_reg_handoff_bootp(void);
|
||||
|
@ -1211,7 +1212,7 @@ static void uat_bootp_record_update_cb(void* r, const char** err) {
|
|||
uat_bootp_record_t* rec = (uat_bootp_record_t *)r;
|
||||
|
||||
if ((rec->opt == 0) || (rec->opt >=BOOTP_OPT_NUM-1))
|
||||
*err = ep_strdup_printf("Option must be between 1 and %d", BOOTP_OPT_NUM-2);
|
||||
*err = wmem_strdup_printf(wmem_packet_scope(), "Option must be between 1 and %d", BOOTP_OPT_NUM-2);
|
||||
}
|
||||
|
||||
static void uat_bootp_record_free_cb(void*r) {
|
||||
|
@ -4334,7 +4335,7 @@ static void get_opt60_tlv(tvbuff_t *tvb, guint off, guint8 *tlvtype, guint8 *tlv
|
|||
guint i;
|
||||
guint8 *val_asc;
|
||||
|
||||
val_asc = (guint8 *)ep_alloc0(4);
|
||||
val_asc = (guint8 *)wmem_alloc0(wmem_packet_scope(), 4);
|
||||
/* Type */
|
||||
tvb_memcpy(tvb, val_asc, off, 2);
|
||||
*tlvtype = (guint8)strtoul((gchar*)val_asc, NULL, 16);
|
||||
|
@ -4342,7 +4343,7 @@ static void get_opt60_tlv(tvbuff_t *tvb, guint off, guint8 *tlvtype, guint8 *tlv
|
|||
tvb_memcpy(tvb, val_asc, off + 2, 2);
|
||||
*tlvlen = (guint8)strtoul((gchar*)val_asc, NULL, 16);
|
||||
/* Value */
|
||||
*value = (guint8 *)ep_alloc0(*tlvlen);
|
||||
*value = (guint8 *)wmem_alloc0(wmem_packet_scope(), *tlvlen);
|
||||
for (i=0; i<*tlvlen; i++)
|
||||
{
|
||||
memset(val_asc, 0, 4);
|
||||
|
@ -4366,7 +4367,7 @@ dissect_docsis_cm_cap(proto_tree *v_tree, tvbuff_t *tvb, int voff, int len, gboo
|
|||
guint8 *val_other = NULL;
|
||||
guint off = voff;
|
||||
|
||||
asc_val = (guint8*)ep_alloc0(4);
|
||||
asc_val = (guint8*)wmem_alloc0(wmem_packet_scope(), 4);
|
||||
|
||||
if (opt125)
|
||||
{
|
||||
|
@ -5310,7 +5311,7 @@ bootp_init_protocol(void)
|
|||
/* Now apply the custom options */
|
||||
for (i = 0; i < num_bootp_records_uat; i++)
|
||||
{
|
||||
bootp_opt[uat_bootp_records[i].opt].text = se_strdup(uat_bootp_records[i].text);
|
||||
bootp_opt[uat_bootp_records[i].opt].text = wmem_strdup(wmem_file_scope(), uat_bootp_records[i].text);
|
||||
bootp_opt[uat_bootp_records[i].opt].ftype = uat_bootp_records[i].ftype;
|
||||
bootp_opt[uat_bootp_records[i].opt].phf = NULL;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include <epan/packet.h>
|
||||
#include <epan/prefs.h>
|
||||
#include <epan/emem.h>
|
||||
#include <epan/wmem/wmem.h>
|
||||
|
||||
#include "packet-bssap.h"
|
||||
#include "packet-sccp.h"
|
||||
|
@ -644,7 +644,7 @@ unpack_digits(tvbuff_t *tvb, int offset, dgt_set_t *dgt, gboolean skip_first)
|
|||
length = tvb_length(tvb);
|
||||
if (length < offset)
|
||||
return "";
|
||||
digit_str = (char *)ep_alloc((length - offset)*2+1);
|
||||
digit_str = (char *)wmem_alloc(wmem_packet_scope(), (length - offset)*2+1);
|
||||
|
||||
while (offset < length) {
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <epan/packet.h>
|
||||
#include <epan/conversation.h>
|
||||
#include <epan/prefs.h>
|
||||
#include <epan/wmem/wmem.h>
|
||||
|
||||
/* Specifications: BEP-0005
|
||||
* http://www.bittorrent.org/beps/bep_0005.html
|
||||
|
@ -224,7 +225,7 @@ dissect_bt_dht_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint
|
|||
|
||||
proto_item_set_text( ti, "%s: error %s, %s", label, error_no, error_msg );
|
||||
col_append_fstr( pinfo->cinfo, COL_INFO, "error_no=%s error_msg=%s ", error_no, error_msg );
|
||||
*result = ep_strdup_printf("error %s, %s", error_no, error_msg );
|
||||
*result = wmem_strdup_printf(wmem_packet_scope(), "error %s, %s", error_no, error_msg );
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
@ -281,7 +282,7 @@ dissect_bt_dht_values(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint
|
|||
|
||||
proto_item_set_text( ti, "%s: %d peers", label, peer_index );
|
||||
col_append_fstr( pinfo->cinfo, COL_INFO, "reply=%d peers ", peer_index );
|
||||
*result = ep_strdup_printf("%d peers", peer_index);
|
||||
*result = wmem_strdup_printf(wmem_packet_scope(), "%d peers", peer_index);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
@ -327,7 +328,7 @@ dissect_bt_dht_nodes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint
|
|||
}
|
||||
proto_item_set_text( ti, "%s: %d nodes", label, node_index );
|
||||
col_append_fstr( pinfo->cinfo, COL_INFO, "reply=%d nodes ", node_index );
|
||||
*result = ep_strdup_printf("%d", node_index);
|
||||
*result = wmem_strdup_printf(wmem_packet_scope(), "%d", node_index);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
|
|
@ -327,7 +327,7 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
key[4].length = 0;
|
||||
key[4].key = NULL;
|
||||
|
||||
chandle_data = (chandle_data_t *)se_alloc(sizeof(chandle_data_t));
|
||||
chandle_data = (chandle_data_t *)wmem_alloc(wmem_file_scope(), sizeof(chandle_data_t));
|
||||
chandle_data->start_fragments = wmem_tree_new(wmem_file_scope());
|
||||
chandle_data->interface_id = hci_data->interface_id;
|
||||
chandle_data->adapter_id = hci_data->adapter_id;
|
||||
|
|
Loading…
Reference in New Issue