udpdump: don't call inet_addr() for every packet.

Change-Id: Id3d9229f5d61390f2f4127c8dfdf445935297e85
Reviewed-on: https://code.wireshark.org/review/24300
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Dario Lombardo 2017-11-08 13:01:26 +01:00 committed by Michael Mann
parent 8730b2037a
commit 36faf3203a
1 changed files with 3 additions and 1 deletions

View File

@ -81,6 +81,7 @@
#define EXP_PDU_TAG_DST_PORT 26
static gboolean run_loop = TRUE;
static uint32_t localhost = 0;
enum {
EXTCAP_BASE_OPTIONS_ENUM,
@ -283,7 +284,7 @@ static int dump_packet(const char* proto_name, const guint16 listenport, const c
add_proto_name(mbuf, &offset, proto_name);
add_ip_source_address(mbuf, &offset, clientaddr.sin_addr.s_addr);
add_ip_dest_address(mbuf, &offset, inet_addr("127.0.0.1"));
add_ip_dest_address(mbuf, &offset, localhost);
add_udp_source_port(mbuf, &offset, clientaddr.sin_port);
add_udp_dst_port(mbuf, &offset, listenport);
add_end_options(mbuf, &offset);
@ -328,6 +329,7 @@ static void run_listener(const char* fifo, const guint16 port, const char* proto
g_debug("Listener running on port %u", port);
buf = (char*)g_malloc(PKT_BUF_SIZE);
localhost = inet_addr("127.0.0.1");
while(run_loop == TRUE) {
memset(buf, 0x0, PKT_BUF_SIZE);