aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2017-11-08 13:01:26 +0100
committerMichael Mann <mmann78@netscape.net>2017-11-08 15:36:09 +0000
commit36faf3203af3a5b77cbe19f232ee77b7ddd2cd50 (patch)
tree9188ae262e2973f8b7d1ffef5fa8049fa1a1b65c
parent8730b2037a6a999af28594607a4c27c3837f8f83 (diff)
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>
-rw-r--r--extcap/udpdump.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/extcap/udpdump.c b/extcap/udpdump.c
index 907c896..88da1b8 100644
--- a/extcap/udpdump.c
+++ b/extcap/udpdump.c
@@ -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);