summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2012-11-15 21:15:42 -0800
committerSam Roberts <vieuxtech@gmail.com>2012-11-16 21:04:55 -0800
commit1f39883bc656605ecde816fc1f5238ff86b83e53 (patch)
tree53bc86b5440c0f02490001bd576e2b0c7e7e79ca
parent2e724b2f5cd614d7362f8dcbc57dc1fca6e437b3 (diff)
downloadlibnet-1f39883bc656605ecde816fc1f5238ff86b83e53.tar.gz
Fixes error messages sometimes include newline, sometimes not.
-rw-r--r--libnet/src/libnet_advanced.c10
-rw-r--r--libnet/src/libnet_build_arp.c2
-rw-r--r--libnet/src/libnet_build_dhcp.c2
-rw-r--r--libnet/src/libnet_build_gre.c2
-rw-r--r--libnet/src/libnet_build_hsrp.c2
-rw-r--r--libnet/src/libnet_build_icmp.c2
-rw-r--r--libnet/src/libnet_build_ip.c16
-rw-r--r--libnet/src/libnet_build_link.c4
-rw-r--r--libnet/src/libnet_build_tcp.c4
-rw-r--r--libnet/src/libnet_build_token_ring.c4
-rw-r--r--libnet/src/libnet_checksum.c14
-rw-r--r--libnet/src/libnet_cq.c18
-rw-r--r--libnet/src/libnet_if_addr.c24
-rw-r--r--libnet/src/libnet_init.c6
-rw-r--r--libnet/src/libnet_link_bpf.c22
-rw-r--r--libnet/src/libnet_link_dlpi.c20
-rw-r--r--libnet/src/libnet_link_linux.c8
-rw-r--r--libnet/src/libnet_link_none.c2
-rw-r--r--libnet/src/libnet_link_pf.c4
-rw-r--r--libnet/src/libnet_link_win32.c18
-rw-r--r--libnet/src/libnet_pblock.c20
-rw-r--r--libnet/src/libnet_port_list.c8
-rw-r--r--libnet/src/libnet_prand.c2
-rw-r--r--libnet/src/libnet_raw.c16
-rw-r--r--libnet/src/libnet_resolve.c22
-rw-r--r--libnet/src/libnet_write.c20
26 files changed, 136 insertions, 136 deletions
diff --git a/libnet/src/libnet_advanced.c b/libnet/src/libnet_advanced.c
index cf25258..2ea4874 100644
--- a/libnet/src/libnet_advanced.c
+++ b/libnet/src/libnet_advanced.c
@@ -41,7 +41,7 @@ libnet_adv_cull_packet(libnet_t *l, uint8_t **packet, uint32_t *packet_s)
if (l->injection_type != LIBNET_LINK_ADV)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): advanced link mode not enabled\n", __func__);
+ "%s(): advanced link mode not enabled", __func__);
return (-1);
}
@@ -61,7 +61,7 @@ libnet_adv_cull_header(libnet_t *l, libnet_ptag_t ptag, uint8_t **header,
if (l->injection_type != LIBNET_LINK_ADV)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): advanced link mode not enabled\n", __func__);
+ "%s(): advanced link mode not enabled", __func__);
return (-1);
}
@@ -69,7 +69,7 @@ libnet_adv_cull_header(libnet_t *l, libnet_ptag_t ptag, uint8_t **header,
if (p == NULL)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): ptag not found, you sure it exists?\n", __func__);
+ "%s(): ptag not found, you sure it exists?", __func__);
return (-1);
}
*header = p->buf;
@@ -86,7 +86,7 @@ libnet_adv_write_link(libnet_t *l, const uint8_t *packet, uint32_t packet_s)
if (l->injection_type != LIBNET_LINK_ADV)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): advanced link mode not enabled\n", __func__);
+ "%s(): advanced link mode not enabled", __func__);
return (-1);
}
c = libnet_write_link(l, packet, packet_s);
@@ -120,7 +120,7 @@ libnet_adv_write_raw_ipv4(libnet_t *l, const uint8_t *packet, uint32_t packet_s)
if (l->injection_type != LIBNET_RAW4_ADV)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): advanced raw4 mode not enabled\n", __func__);
+ "%s(): advanced raw4 mode not enabled", __func__);
return (-1);
}
c = libnet_write_raw_ipv4(l, packet, packet_s);
diff --git a/libnet/src/libnet_build_arp.c b/libnet/src/libnet_build_arp.c
index e1ad91d..5c06dae 100644
--- a/libnet/src/libnet_build_arp.c
+++ b/libnet/src/libnet_build_arp.c
@@ -124,7 +124,7 @@ uint8_t *tpa, libnet_t *l)
default:
hrd = 0;
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): unsupported link type\n", __func__);
+ "%s(): unsupported link type", __func__);
return (-1);
/* add other link-layers */
}
diff --git a/libnet/src/libnet_build_dhcp.c b/libnet/src/libnet_build_dhcp.c
index fa16c45..0fc49fa 100644
--- a/libnet/src/libnet_build_dhcp.c
+++ b/libnet/src/libnet_build_dhcp.c
@@ -100,7 +100,7 @@ libnet_t *l, libnet_ptag_t ptag)
if (payload_s && !payload)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): payload inconsistency\n", __func__);
+ "%s(): payload inconsistency", __func__);
goto bad;
}
diff --git a/libnet/src/libnet_build_gre.c b/libnet/src/libnet_build_gre.c
index 0790295..6599aba 100644
--- a/libnet/src/libnet_build_gre.c
+++ b/libnet/src/libnet_build_gre.c
@@ -325,7 +325,7 @@ libnet_ptag_t ptag)
if ((routing && !length) || (!routing && length))
{
- sprintf(l->err_buf, "%s(): routing inconsistency\n", __func__);
+ sprintf(l->err_buf, "%s(): routing inconsistency", __func__);
goto bad;
}
diff --git a/libnet/src/libnet_build_hsrp.c b/libnet/src/libnet_build_hsrp.c
index f11af33..a73cfd2 100644
--- a/libnet/src/libnet_build_hsrp.c
+++ b/libnet/src/libnet_build_hsrp.c
@@ -77,7 +77,7 @@ const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
if (payload_s && !payload)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): payload inconsistency\n", __func__);
+ "%s(): payload inconsistency", __func__);
goto bad;
}
diff --git a/libnet/src/libnet_build_icmp.c b/libnet/src/libnet_build_icmp.c
index 25a753f..1a53df6 100644
--- a/libnet/src/libnet_build_icmp.c
+++ b/libnet/src/libnet_build_icmp.c
@@ -47,7 +47,7 @@ do \
if (payload_s && !payload) \
{ \
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, \
- "%s(): payload inconsistency\n", __func__); \
+ "%s(): payload inconsistency", __func__); \
goto bad; \
} \
\
diff --git a/libnet/src/libnet_build_ip.c b/libnet/src/libnet_build_ip.c
index c75340f..23916ac 100644
--- a/libnet/src/libnet_build_ip.c
+++ b/libnet/src/libnet_build_ip.c
@@ -126,14 +126,14 @@ const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
else
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): IPv4 data pblock not found\n", __func__);
+ "%s(): IPv4 data pblock not found", __func__);
}
}
if (payload_s && !payload)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): payload inconsistency\n", __func__);
+ "%s(): payload inconsistency", __func__);
goto bad;
}
@@ -335,7 +335,7 @@ libnet_ptag_t ptag)
if (options_s > LIBNET_MAXOPTION_SIZE)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): options list is too large %d\n", __func__, options_s);
+ "%s(): options list is too large %d", __func__, options_s);
return (-1);
}
@@ -425,7 +425,7 @@ const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
if (LIBNET_IPV6_H + payload_s > IP_MAXPACKET)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): IP packet too large\n", __func__);
+ "%s(): IP packet too large", __func__);
return (-1);
}
@@ -491,7 +491,7 @@ libnet_ptag_t ptag)
if (LIBNET_IPV6_FRAG_H + payload_s > IP_MAXPACKET)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): IP packet too large\n", __func__);
+ "%s(): IP packet too large", __func__);
return (-1);
}
@@ -560,7 +560,7 @@ libnet_ptag_t ptag)
if (LIBNET_IPV6_ROUTING_H + payload_s > IP_MAXPACKET)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): IP packet too large\n", __func__);
+ "%s(): IP packet too large", __func__);
return (-1);
}
@@ -628,7 +628,7 @@ uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
if (LIBNET_IPV6_DESTOPTS_H + payload_s > IP_MAXPACKET)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): IP packet too large\n", __func__);
+ "%s(): IP packet too large", __func__);
return (-1);
}
@@ -694,7 +694,7 @@ uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
if (LIBNET_IPV6_HBHOPTS_H + payload_s > IP_MAXPACKET)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): IP packet too large\n", __func__);
+ "%s(): IP packet too large", __func__);
return (-1);
}
diff --git a/libnet/src/libnet_build_link.c b/libnet/src/libnet_build_link.c
index d2b851c..40cd8b8 100644
--- a/libnet/src/libnet_build_link.c
+++ b/libnet/src/libnet_build_link.c
@@ -52,7 +52,7 @@ const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
l, ptag);
}
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): linktype %d not supported\n", __func__, l->link_type);
+ "%s(): linktype %d not supported", __func__, l->link_type);
return -1;
}
@@ -71,7 +71,7 @@ libnet_autobuild_link(const uint8_t *dst, const uint8_t *oui, uint16_t type, lib
LIBNET_SAP_SNAP, 0x03, org, TOKEN_RING_TYPE_IP, l));
}
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): linktype %d not supported\n", __func__, l->link_type);
+ "%s(): linktype %d not supported", __func__, l->link_type);
return (-1);
}
diff --git a/libnet/src/libnet_build_tcp.c b/libnet/src/libnet_build_tcp.c
index e0c0fcb..2697d28 100644
--- a/libnet/src/libnet_build_tcp.c
+++ b/libnet/src/libnet_build_tcp.c
@@ -49,7 +49,7 @@ libnet_build_tcp(
if (payload_s && !payload)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): payload inconsistency\n", __func__);
+ "%s(): payload inconsistency", __func__);
return -1;
}
@@ -200,7 +200,7 @@ libnet_ptag_t ptag)
if (options_s > LIBNET_MAXOPTION_SIZE)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): options list is too large %d\n", __func__, options_s);
+ "%s(): options list is too large %d", __func__, options_s);
return (-1);
}
diff --git a/libnet/src/libnet_build_token_ring.c b/libnet/src/libnet_build_token_ring.c
index d0c2e0b..03a0f62 100644
--- a/libnet/src/libnet_build_token_ring.c
+++ b/libnet/src/libnet_build_token_ring.c
@@ -50,7 +50,7 @@ const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
!(((l->injection_type) & LIBNET_ADV_MASK)))
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): called with non-link layer wire injection primitive\n",
+ "%s(): called with non-link layer wire injection primitive",
__func__);
p = NULL;
goto bad;
@@ -119,7 +119,7 @@ libnet_t *l)
!(((l->injection_type) & LIBNET_ADV_MASK)))
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): called with non-link layer wire injection primitive\n",
+ "%s(): called with non-link layer wire injection primitive",
__func__);
p = NULL;
goto bad;
diff --git a/libnet/src/libnet_checksum.c b/libnet/src/libnet_checksum.c
index 1a7b796..01a1dd4 100644
--- a/libnet/src/libnet_checksum.c
+++ b/libnet/src/libnet_checksum.c
@@ -126,7 +126,7 @@ static int check_ip_payload_size(libnet_t*l, const uint8_t *iphdr, int ip_hl, in
if((iphdr+ip_hl+h_len) > end)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): ip payload not inside packet (pktsz %d, iphsz %d, payloadsz %d)\n", func,
+ "%s(): ip payload not inside packet (pktsz %d, iphsz %d, payloadsz %d)", func,
(int)(end - iphdr), ip_hl, h_len);
return -1;
}
@@ -187,7 +187,7 @@ libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const
if(iphdr < beg || (iphdr+sizeof(*iph_p)) > end)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): ipv4 hdr not inside packet (where %d, size %d)\n", __func__,
+ "%s(): ipv4 hdr not inside packet (where %d, size %d)", __func__,
(int)(iphdr-beg), (int)(end-beg));
return -1;
}
@@ -204,7 +204,7 @@ libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const
if((uint8_t*)(ip6h_p+1) > end)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): ipv6 hdr not inside packet\n", __func__);
+ "%s(): ipv6 hdr not inside packet", __func__);
return -1;
}
}
@@ -216,7 +216,7 @@ libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const
if((iphdr+ip_hl) > end)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): ip hdr len not inside packet\n", __func__);
+ "%s(): ip hdr len not inside packet", __func__);
return -1;
}
@@ -373,7 +373,7 @@ libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const
!(fv & (GRE_CSUM|GRE_VERSION_1)))
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): can't compute GRE checksum (wrong flags_ver bits: 0x%x )\n", __func__, fv);
+ "%s(): can't compute GRE checksum (wrong flags_ver bits: 0x%x )", __func__, fv);
return (-1);
}
sum = libnet_in_cksum((uint16_t *)greh_p, h_len);
@@ -489,7 +489,7 @@ libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const
if((iphdr+h_len) > end)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): cdp payload not inside packet\n", __func__);
+ "%s(): cdp payload not inside packet", __func__);
return -1;
}
@@ -512,7 +512,7 @@ libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const
default:
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): unsupported protocol %d\n", __func__, protocol);
+ "%s(): unsupported protocol %d", __func__, protocol);
return (-1);
}
}
diff --git a/libnet/src/libnet_cq.c b/libnet/src/libnet_cq.c
index a4580b8..7f05204 100644
--- a/libnet/src/libnet_cq.c
+++ b/libnet/src/libnet_cq.c
@@ -81,14 +81,14 @@ libnet_cq_add(libnet_t *l, char *label)
if (cq_is_wlocked())
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): can't add, context queue is write locked\n", __func__);
+ "%s(): can't add, context queue is write locked", __func__);
return (-1);
}
/* ensure there is a label */
if (label == NULL)
{
- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): empty label\n",
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): empty label",
__func__);
return (-1);
}
@@ -100,7 +100,7 @@ libnet_cq_add(libnet_t *l, char *label)
if (l_cq == NULL)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): can't malloc initial context queue: %s\n",
+ "%s(): can't malloc initial context queue: %s",
__func__, strerror(errno));
return (-1);
}
@@ -131,7 +131,7 @@ libnet_cq_add(libnet_t *l, char *label)
if (l_cq == NULL)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): can't malloc new context queue: %s\n",
+ "%s(): can't malloc new context queue: %s",
__func__, strerror(errno));
return (-1);
}
@@ -163,7 +163,7 @@ libnet_cq_remove(libnet_t *l)
if (l_cq == NULL)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): can't remove from empty context queue\n", __func__);
+ "%s(): can't remove from empty context queue", __func__);
return (NULL);
}
@@ -176,7 +176,7 @@ libnet_cq_remove(libnet_t *l)
if (cq_is_wlocked())
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): can't remove, context queue is write locked\n",
+ "%s(): can't remove, context queue is write locked",
__func__);
return (NULL);
}
@@ -184,7 +184,7 @@ libnet_cq_remove(libnet_t *l)
if ((p = libnet_cq_find_internal(l)) == NULL)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): context not present in context queue\n", __func__);
+ "%s(): context not present in context queue", __func__);
return (NULL);
}
@@ -275,13 +275,13 @@ libnet_cq_dup_check(libnet_t *l, char *label)
if (p->context == l)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): context already in context queue\n", __func__);
+ "%s(): context already in context queue", __func__);
return (1);
}
if (strncmp(p->context->label, label, LIBNET_LABEL_SIZE) == 0)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): duplicate label %s\n", __func__, label);
+ "%s(): duplicate label %s", __func__, label);
return (1);
}
}
diff --git a/libnet/src/libnet_if_addr.c b/libnet/src/libnet_if_addr.c
index 7e0a2a6..082e022 100644
--- a/libnet/src/libnet_if_addr.c
+++ b/libnet/src/libnet_if_addr.c
@@ -55,7 +55,7 @@ libnet_check_iface(libnet_t *l)
fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0)
{
- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s() socket: %s\n", __func__,
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s() socket: %s", __func__,
strerror(errno));
return (-1);
}
@@ -67,14 +67,14 @@ libnet_check_iface(libnet_t *l)
if (res < 0)
{
- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s() ioctl: %s\n", __func__,
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s() ioctl: %s", __func__,
strerror(errno));
}
else
{
if ((ifr.ifr_flags & IFF_UP) == 0)
{
- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): %s is down\n",
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): %s is down",
__func__, l->device);
res = -1;
}
@@ -125,7 +125,7 @@ register char *errbuf)
fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0)
{
- snprintf(errbuf, LIBNET_ERRBUF_SIZE, "%s(): socket error: %s\n",
+ snprintf(errbuf, LIBNET_ERRBUF_SIZE, "%s(): socket error: %s",
__func__, strerror(errno));
return (-1);
}
@@ -134,7 +134,7 @@ register char *errbuf)
if ((fp = fopen(PROC_DEV_FILE, "r")) == NULL)
{
snprintf(errbuf, LIBNET_ERRBUF_SIZE,
- "%s(): fopen(proc_dev_file) failed: %s\n", __func__,
+ "%s(): fopen(proc_dev_file) failed: %s", __func__,
strerror(errno));
return (-1);
}
@@ -147,7 +147,7 @@ register char *errbuf)
if(ioctl(fd, SIOCGIFCONF, &ifc) < 0)
{
snprintf(errbuf, LIBNET_ERRBUF_SIZE,
- "%s(): ioctl(SIOCGIFCONF) error: %s\n",
+ "%s(): ioctl(SIOCGIFCONF) error: %s",
__func__, strerror(errno));
#ifdef HAVE_LINUX_PROCFS
fclose(fp);
@@ -219,7 +219,7 @@ register char *errbuf)
if (errno != EADDRNOTAVAIL)
{
snprintf(errbuf, LIBNET_ERRBUF_SIZE,
- "%s(): SIOCGIFADDR: dev=%s: %s\n", __func__, device,
+ "%s(): SIOCGIFADDR: dev=%s: %s", __func__, device,
strerror(errno));
close(fd);
#ifdef HAVE_LINUX_PROCFS
@@ -243,7 +243,7 @@ register char *errbuf)
if ((al->device = strdup(device)) == NULL)
{
snprintf(errbuf, LIBNET_ERRBUF_SIZE,
- "%s(): strdup not enough memory\n", __func__);
+ "%s(): strdup not enough memory", __func__);
#ifdef HAVE_LINUX_PROCFS
fclose(fp);
#endif
@@ -263,7 +263,7 @@ register char *errbuf)
if (ferror(fp))
{
snprintf(errbuf, LIBNET_ERRBUF_SIZE,
- "%s(): ferror: %s\n", __func__, strerror(errno));
+ "%s(): ferror: %s", __func__, strerror(errno));
fclose(fp);
return (-1);
}
@@ -304,7 +304,7 @@ register char *errbuf)
if (pcap_findalldevs(&alldevs, err) == -1)
{
snprintf(errbuf, LIBNET_ERRBUF_SIZE,
- "%s(): error in pcap_findalldevs: %s\n", __func__, err);
+ "%s(): error in pcap_findalldevs: %s", __func__, err);
return (-1);
}
@@ -367,7 +367,7 @@ libnet_select_device(libnet_t *l)
else if (c == 0)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): no network interface found\n", __func__);
+ "%s(): no network interface found", __func__);
return (-1);
}
@@ -394,7 +394,7 @@ libnet_select_device(libnet_t *l)
if (i <= 0)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): can't find interface for IP %s\n", __func__,
+ "%s(): can't find interface for IP %s", __func__,
l->device);
goto bad;
}
diff --git a/libnet/src/libnet_init.c b/libnet/src/libnet_init.c
index c33369c..c00f5a9 100644
--- a/libnet/src/libnet_init.c
+++ b/libnet/src/libnet_init.c
@@ -43,7 +43,7 @@ libnet_init(int injection_type, const char *device, char *err_buf)
if ((WSAStartup(0x0202, &wsaData)) != 0)
{
snprintf(err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): unable to initialize winsock 2\n", __func__);
+ "%s(): unable to initialize winsock 2", __func__);
goto bad;
}
#endif
@@ -51,7 +51,7 @@ libnet_init(int injection_type, const char *device, char *err_buf)
l = (libnet_t *)malloc(sizeof (libnet_t));
if (l == NULL)
{
- snprintf(err_buf, LIBNET_ERRBUF_SIZE, "%s(): malloc(): %s\n", __func__,
+ snprintf(err_buf, LIBNET_ERRBUF_SIZE, "%s(): malloc(): %s", __func__,
strerror(errno));
goto bad;
}
@@ -101,7 +101,7 @@ libnet_init(int injection_type, const char *device, char *err_buf)
break;
default:
snprintf(err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): unsupported injection type\n", __func__);
+ "%s(): unsupported injection type", __func__);
goto bad;
break;
}
diff --git a/libnet/src/libnet_link_bpf.c b/libnet/src/libnet_link_bpf.c
index 794fbf9..875a8e4 100644
--- a/libnet/src/libnet_link_bpf.c
+++ b/libnet/src/libnet_link_bpf.c
@@ -83,7 +83,7 @@ libnet_bpf_open(char *err_buf)
if (fd == -1)
{
- snprintf(err_buf, LIBNET_ERRBUF_SIZE, "%s(): open(): (%s): %s\n",
+ snprintf(err_buf, LIBNET_ERRBUF_SIZE, "%s(): open(): (%s): %s",
__func__, device, strerror(errno));
}
return (fd);
@@ -108,7 +108,7 @@ libnet_open_link(libnet_t *l)
if (l->device == NULL)
{
- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): NULL device\n",
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): NULL device",
__func__);
goto bad;
}
@@ -124,7 +124,7 @@ libnet_open_link(libnet_t *l)
*/
if (ioctl(l->fd, BIOCVERSION, (caddr_t)&bv) < 0)
{
- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): BIOCVERSION: %s\n",
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): BIOCVERSION: %s",
__func__, strerror(errno));
goto bad;
}
@@ -132,7 +132,7 @@ libnet_open_link(libnet_t *l)
if (bv.bv_major != BPF_MAJOR_VERSION || bv.bv_minor < BPF_MINOR_VERSION)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): kernel bpf filter out of date\n", __func__);
+ "%s(): kernel bpf filter out of date", __func__);
goto bad;
}
@@ -144,7 +144,7 @@ libnet_open_link(libnet_t *l)
if (ioctl(l->fd, BIOCSETIF, (caddr_t)&ifr) == -1)
{
- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): BIOCSETIF: (%s): %s\n",
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): BIOCSETIF: (%s): %s",
__func__, l->device, strerror(errno));
goto bad;
}
@@ -154,7 +154,7 @@ libnet_open_link(libnet_t *l)
*/
if (ioctl(l->fd, BIOCGDLT, (caddr_t)&v) == -1)
{
- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): BIOCGDLT: %s\n",
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): BIOCGDLT: %s",
__func__, strerror(errno));
goto bad;
}
@@ -166,7 +166,7 @@ libnet_open_link(libnet_t *l)
#if defined(BIOCGHDRCMPLT) && defined(BIOCSHDRCMPLT) && !(__APPLE__)
if (ioctl(l->fd, BIOCSHDRCMPLT, &spoof_eth_src) == -1)
{
- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): BIOCSHDRCMPLT: %s\n",
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): BIOCSHDRCMPLT: %s",
__func__, strerror(errno));
goto bad;
}
@@ -245,7 +245,7 @@ libnet_write_link(libnet_t *l, const uint8_t *packet, uint32_t size)
if (c != size)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): %d bytes written (%s)\n", __func__, c, strerror(errno));
+ "%s(): %d bytes written (%s)", __func__, c, strerror(errno));
}
return (c);
}
@@ -285,7 +285,7 @@ libnet_get_hwaddr(libnet_t *l)
if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1)
{
- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): sysctl(): %s\n",
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): sysctl(): %s",
__func__, strerror(errno));
return (NULL);
}
@@ -293,13 +293,13 @@ libnet_get_hwaddr(libnet_t *l)
buf = (int8_t *)malloc(len);
if (buf == NULL)
{
- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): malloc(): %s\n",
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): malloc(): %s",
__func__, strerror(errno));
return (NULL);
}
if (sysctl(mib, 6, buf, &len, NULL, 0) < 0)
{
- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): sysctl(): %s\n",
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): sysctl(): %s",
__func__, strerror(errno));
free(buf);
return (NULL);
diff --git a/libnet/src/libnet_link_dlpi.c b/libnet/src/libnet_link_dlpi.c
index 22c63b4..46323e5 100644
--- a/libnet/src/libnet_link_dlpi.c
+++ b/libnet/src/libnet_link_dlpi.c
@@ -173,7 +173,7 @@ try_open_dev(libnet_t *l, const char *dev, int unit)
return ret;
}
if (errno != ENOENT && errno != EISDIR) {
- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): open(): %s: %s\n",
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): open(): %s: %s",
__func__, fullpath, strerror(errno));
return -1;
}
@@ -183,7 +183,7 @@ try_open_dev(libnet_t *l, const char *dev, int unit)
return ret;
}
if (errno != ENOENT && errno != EISDIR) {
- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): open(): %s: %s\n",
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): open(): %s: %s",
__func__, fullpath, strerror(errno));
return -1;
}
@@ -214,7 +214,7 @@ libnet_open_link(libnet_t *l)
*/
if (!dlpi_unit(l->device, &namelen, &ppa)) {
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): %s has bad device type or unit number\n",
+ "%s(): %s has bad device type or unit number",
__func__, l->device);
goto bad;
}
@@ -312,7 +312,7 @@ libnet_open_link(libnet_t *l)
l->link_offset = 0x16;
break;
default:
- sprintf(l->err_buf, "%s(): unknown mac type 0x%lu\n", __func__,
+ sprintf(l->err_buf, "%s(): unknown mac type 0x%lu", __func__,
(uint32_t) infop->dl_mac_type);
goto bad;
}
@@ -323,7 +323,7 @@ libnet_open_link(libnet_t *l)
*/
if (strioctl(l->fd, DLIOCRAW, 0, NULL) < 0)
{
- sprintf(l->err_buf, "%s(): DLIOCRAW: %s\n", __func__, strerror(errno));
+ sprintf(l->err_buf, "%s(): DLIOCRAW: %s", __func__, strerror(errno));
goto bad;
}
#endif
@@ -350,7 +350,7 @@ int flags)
if (putmsg(fd, &ctl, (struct strbuf *) NULL, flags) < 0)
{
- sprintf(ebuf, "%s(): putmsg \"%s\": %s\n", __func__, what,
+ sprintf(ebuf, "%s(): putmsg \"%s\": %s", __func__, what,
strerror(errno));
return (-1);
}
@@ -371,7 +371,7 @@ recv_ack(int fd, int size, const int8_t *what, int8_t *bufp, int8_t *ebuf)
flags = 0;
if (getmsg(fd, &ctl, (struct strbuf*)NULL, &flags) < 0)
{
- sprintf(ebuf, "%s(): %s getmsg: %s\n", __func__, what, strerror(errno));
+ sprintf(ebuf, "%s(): %s getmsg: %s", __func__, what, strerror(errno));
return (-1);
}
@@ -568,7 +568,7 @@ register int8_t *ebuf)
if (ip->dl_hdw_state == HDW_DEAD)
{
- sprintf(ebuf, "%s: hardware state: DOWN\n", device);
+ sprintf(ebuf, "%s: hardware state: DOWN", device);
return (-1);
}
return ((int)ip->dl_ppa);
@@ -728,7 +728,7 @@ libnet_write_link(libnet_t *l, const uint8_t *packet, uint32_t size)
if (c == -1)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "libnet_write_link(): %d bytes written (%s)\n", c,
+ "libnet_write_link(): %d bytes written (%s)", c,
strerror(errno));
return (-1);
}
@@ -757,7 +757,7 @@ libnet_write_link(libnet_t *l, const uint8_t *packet, uint32_t size)
if (c == -1)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "libnet_write_link: %d bytes written (%s)\n", c,
+ "libnet_write_link: %d bytes written (%s)", c,
strerror(errno));
return (-1);
}
diff --git a/libnet/src/libnet_link_linux.c b/libnet/src/libnet_link_linux.c
index 924c106..054458d 100644
--- a/libnet/src/libnet_link_linux.c
+++ b/libnet/src/libnet_link_linux.c
@@ -141,7 +141,7 @@ libnet_open_link(libnet_t *l)
default:
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "unknown physical layer type 0x%x\n",
+ "unknown physical layer type 0x%x",
ifr.ifr_hwaddr.sa_family);
goto bad;
}
@@ -157,7 +157,7 @@ libnet_open_link(libnet_t *l)
if (setsockopt(l->fd, SOL_SOCKET, SO_BROADCAST, &n, sizeof(n)) == -1)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s: set SO_BROADCAST failed: %s\n",
+ "%s: set SO_BROADCAST failed: %s",
__func__, strerror(errno));
goto bad;
}
@@ -242,7 +242,7 @@ libnet_write_link(libnet_t *l, const uint8_t *packet, uint32_t size)
if (c != size)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "libnet_write_link(): only %d bytes written (%s)\n", c,
+ "libnet_write_link(): only %d bytes written (%s)", c,
strerror(errno));
}
return (c);
@@ -270,7 +270,7 @@ libnet_get_hwaddr(libnet_t *l)
if (libnet_select_device(l) == -1)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "libnet_get_hwaddr: can't figure out a device to use\n");
+ "libnet_get_hwaddr: can't figure out a device to use");
return (NULL);
}
}
diff --git a/libnet/src/libnet_link_none.c b/libnet/src/libnet_link_none.c
index d387bc6..8be5fb4 100644
--- a/libnet/src/libnet_link_none.c
+++ b/libnet/src/libnet_link_none.c
@@ -32,7 +32,7 @@
static void nosupport(libnet_t* l)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): no link support on this platform\n", __func__);
+ "%s(): no link support on this platform", __func__);
}
int
diff --git a/libnet/src/libnet_link_pf.c b/libnet/src/libnet_link_pf.c
index 0af154c..2b68634 100644
--- a/libnet/src/libnet_link_pf.c
+++ b/libnet/src/libnet_link_pf.c
@@ -56,7 +56,7 @@ libnet_open_link_interface(int8_t *device, int8_t *ebuf)
l->fd = pfopen(device, O_RDWR);
if (l->fd < 0)
{
- sprintf(ebuf, "pf open: %s: %s\n\your system may not be properly configured; see \"man packetfilter(4)\"\n",
+ sprintf(ebuf, "pf open: %s: %s\n\your system may not be properly configured; see \"man packetfilter(4)\"",
device, strerror(errno));
goto bad;
}
@@ -154,7 +154,7 @@ libnet_write_link_layer(struct libnet_link_int *l, const int8_t *device,
if (c != len)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "libnet_write_link: %d bytes written (%s)\n", c,
+ "libnet_write_link: %d bytes written (%s)", c,
strerror(errno));
}
return (c);
diff --git a/libnet/src/libnet_link_win32.c b/libnet/src/libnet_link_win32.c
index f707f4a..40f84f0 100644
--- a/libnet/src/libnet_link_win32.c
+++ b/libnet/src/libnet_link_win32.c
@@ -55,7 +55,7 @@ libnet_open_link(libnet_t *l)
if (l->device == NULL)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): NULL device\n", __func__);
+ "%s(): NULL device", __func__);
return (-1);
}
@@ -67,7 +67,7 @@ libnet_open_link(libnet_t *l)
{
dwErrorCode=GetLastError();
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): unable to open the driver, error Code : %lx\n",
+ "%s(): unable to open the driver, error Code : %lx",
__func__, dwErrorCode);
return (-1);
}
@@ -96,7 +96,7 @@ libnet_open_link(libnet_t *l)
break;
case NdisMediumWan:
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s():, WinPcap has disabled support for Network type (%d)\n",
+ "%s():, WinPcap has disabled support for Network type (%d)",
__func__, IFType.LinkType);
return (-1);
break;
@@ -108,7 +108,7 @@ libnet_open_link(libnet_t *l)
break;
default:
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): network type (%d) is not supported\n",
+ "%s(): network type (%d) is not supported",
__func__, IFType.LinkType);
return (-1);
break;
@@ -118,7 +118,7 @@ libnet_open_link(libnet_t *l)
{
dwErrorCode=GetLastError();
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): unable to determine the network type, error Code : %lx\n",
+ "%s(): unable to determine the network type, error Code : %lx",
__func__, dwErrorCode);
return (-1);
}
@@ -147,7 +147,7 @@ libnet_write_link(libnet_t *l, const uint8_t *packet, uint32_t size)
if ((lpPacket = PacketAllocatePacket()) == NULL)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): failed to allocate the LPPACKET structure\n", __func__);
+ "%s(): failed to allocate the LPPACKET structure", __func__);
return (-1);
}
PacketInitPacket(lpPacket, packet, size);
@@ -183,7 +183,7 @@ libnet_get_hwaddr(libnet_t *l)
if (libnet_select_device(l) == -1)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): can't figure out a device to use\n", __func__);
+ "%s(): can't figure out a device to use", __func__);
return (NULL);
}
}
@@ -192,7 +192,7 @@ libnet_get_hwaddr(libnet_t *l)
if (mac == NULL)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): calloc error\n", __func__);
+ "%s(): calloc error", __func__);
return (NULL);
}
@@ -201,7 +201,7 @@ libnet_get_hwaddr(libnet_t *l)
if (OidData == NULL)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): OidData is NULL\n", __func__);
+ "%s(): OidData is NULL", __func__);
return(NULL);
}
diff --git a/libnet/src/libnet_pblock.c b/libnet/src/libnet_pblock.c
index 09e880d..a9f239b 100644
--- a/libnet/src/libnet_pblock.c
+++ b/libnet/src/libnet_pblock.c
@@ -73,7 +73,7 @@ libnet_pblock_probe(libnet_t *l, libnet_ptag_t ptag, uint32_t b_len, uint8_t typ
if (p->buf == NULL)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): can't resize pblock buffer: %s\n", __func__,
+ "%s(): can't resize pblock buffer: %s", __func__,
strerror(errno));
return (NULL);
}
@@ -100,7 +100,7 @@ static void* zmalloc(libnet_t* l, uint32_t size, const char* func)
if(v)
memset(v, 0, size);
else
- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): malloc(): %s\n", func,
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): malloc(): %s", func,
strerror(errno));
return v;
}
@@ -253,7 +253,7 @@ libnet_pblock_find(libnet_t *l, libnet_ptag_t ptag)
}
}
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): couldn't find protocol block\n", __func__);
+ "%s(): couldn't find protocol block", __func__);
return (NULL);
}
@@ -263,14 +263,14 @@ libnet_pblock_append(libnet_t *l, libnet_pblock_t *p, const void *buf, uint32_t
if (len && !buf)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): payload inconsistency\n", __func__);
+ "%s(): payload inconsistency", __func__);
return -1;
}
if (p->copied + len > p->b_len)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): memcpy would overflow buffer\n", __func__);
+ "%s(): memcpy would overflow buffer", __func__);
return (-1);
}
memcpy(p->buf + p->copied, buf, len);
@@ -352,7 +352,7 @@ libnet_pblock_coalesce(libnet_t *l, uint8_t **packet, uint32_t *size)
}
if (*packet == NULL)
{
- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): malloc(): %s\n",
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): malloc(): %s",
__func__, strerror(errno));
return (-1);
}
@@ -379,7 +379,7 @@ libnet_pblock_coalesce(libnet_t *l, uint8_t **packet, uint32_t *size)
(l->pblock_end->type != LIBNET_PBLOCK_802_3_H))
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): packet assembly cannot find a layer 2 header\n",
+ "%s(): packet assembly cannot find a layer 2 header",
__func__);
goto err;
}
@@ -388,7 +388,7 @@ libnet_pblock_coalesce(libnet_t *l, uint8_t **packet, uint32_t *size)
if ((l->pblock_end->type != LIBNET_PBLOCK_IPV4_H))
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): packet assembly cannot find an IPv4 header\n",
+ "%s(): packet assembly cannot find an IPv4 header",
__func__);
goto err;
}
@@ -397,7 +397,7 @@ libnet_pblock_coalesce(libnet_t *l, uint8_t **packet, uint32_t *size)
if ((l->pblock_end->type != LIBNET_PBLOCK_IPV6_H))
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): packet assembly cannot find an IPv6 header\n",
+ "%s(): packet assembly cannot find an IPv6 header",
__func__);
goto err;
}
@@ -405,7 +405,7 @@ libnet_pblock_coalesce(libnet_t *l, uint8_t **packet, uint32_t *size)
default:
/* we should not end up here ever */
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): suddenly the dungeon collapses -- you die\n",
+ "%s(): suddenly the dungeon collapses -- you die",
__func__);
goto err;
break;
diff --git a/libnet/src/libnet_port_list.c b/libnet/src/libnet_port_list.c
index 046cb81..3ba7413 100644
--- a/libnet/src/libnet_port_list.c
+++ b/libnet/src/libnet_port_list.c
@@ -70,7 +70,7 @@ libnet_plist_chain_new(libnet_t *l, libnet_plist_t **plist, char *token_list)
if (!valid_token)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "libnet_build_plist_chain: illegal token # %d (%c)\n",
+ "libnet_build_plist_chain: illegal token # %d (%c)",
i + 1,
token_list[i]);
*plist = NULL;
@@ -84,7 +84,7 @@ libnet_plist_chain_new(libnet_t *l, libnet_plist_t **plist, char *token_list)
if (!(*plist))
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "libnet_build_plist_chain: malloc %s\n", strerror(errno));
+ "libnet_build_plist_chain: malloc %s", strerror(errno));
*plist = NULL;
return (-1);
}
@@ -99,7 +99,7 @@ libnet_plist_chain_new(libnet_t *l, libnet_plist_t **plist, char *token_list)
{
all_lists = all_lists_tmp;
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "libnet_build_plist_chain: realloc %s\n", strerror(errno));
+ "libnet_build_plist_chain: realloc %s", strerror(errno));
*plist = NULL;
return(-1);
}
@@ -123,7 +123,7 @@ libnet_plist_chain_new(libnet_t *l, libnet_plist_t **plist, char *token_list)
if (!tmp->next)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "libnet_build_plist_chain: malloc %s\n", strerror(errno));
+ "libnet_build_plist_chain: malloc %s", strerror(errno));
/*
* XXX - potential memory leak if other nodes are allocated
* but not freed.
diff --git a/libnet/src/libnet_prand.c b/libnet/src/libnet_prand.c
index 4fb7329..6c44539 100644
--- a/libnet/src/libnet_prand.c
+++ b/libnet/src/libnet_prand.c
@@ -50,7 +50,7 @@ libnet_seed_prand(libnet_t *l)
if (gettimeofday(&seed, NULL) == -1)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): cannot gettimeofday\n", __func__);
+ "%s(): cannot gettimeofday", __func__);
return (-1);
}
diff --git a/libnet/src/libnet_raw.c b/libnet/src/libnet_raw.c
index 4f79603..c8cfe16 100644
--- a/libnet/src/libnet_raw.c
+++ b/libnet/src/libnet_raw.c
@@ -85,7 +85,7 @@ libnet_open_raw4(libnet_t *l)
if (l->fd == -1)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): SOCK_RAW allocation failed: %s\n",
+ "%s(): SOCK_RAW allocation failed: %s",
__func__, strerror(errno));
goto bad;
}
@@ -108,7 +108,7 @@ libnet_open_raw4(libnet_t *l)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): set IP_HDRINCL failed: %s\n",
+ "%s(): set IP_HDRINCL failed: %s",
__func__, strerror(errno));
goto bad;
}
@@ -127,7 +127,7 @@ libnet_open_raw4(libnet_t *l)
if (getsockopt(l->fd, SOL_SOCKET, SO_SNDBUF, &n, &len) < 0)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): get SO_SNDBUF failed: %s\n",
+ "%s(): get SO_SNDBUF failed: %s",
__func__, strerror(errno));
goto bad;
}
@@ -141,7 +141,7 @@ libnet_open_raw4(libnet_t *l)
break;
}
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): set SO_SNDBUF failed: %s\n",
+ "%s(): set SO_SNDBUF failed: %s",
__func__, strerror(errno));
goto bad;
}
@@ -160,7 +160,7 @@ libnet_open_raw4(libnet_t *l)
if (setsockopt(l->fd, SOL_SOCKET, SO_BROADCAST, nptr, sizeof(n)) == -1)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): set SO_BROADCAST failed: %s\n",
+ "%s(): set SO_BROADCAST failed: %s",
__func__, strerror(errno));
goto bad;
}
@@ -218,7 +218,7 @@ libnet_open_raw6(libnet_t *l)
if (l->fd == -1)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): SOCK_RAW allocation failed: %s\n", __func__,
+ "%s(): SOCK_RAW allocation failed: %s", __func__,
strerror(errno));
goto bad;
}
@@ -227,14 +227,14 @@ libnet_open_raw6(libnet_t *l)
if (setsockopt(l->fd, SOL_SOCKET, SO_BROADCAST, oneptr, sizeof(one)) == -1)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): set SO_BROADCAST failed: %s\n", __func__,
+ "%s(): set SO_BROADCAST failed: %s", __func__,
strerror(errno));
goto bad;
}
if(l->device != NULL)
if(setsockopt(l->fd, SOL_SOCKET, SO_BINDTODEVICE, l->device, strlen(l->device)) == -1) {
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): set SO_BINDTODEVICE failed: %s\n", __func__, strerror(errno));
+ "%s(): set SO_BINDTODEVICE failed: %s", __func__, strerror(errno));
goto bad;
}
diff --git a/libnet/src/libnet_resolve.c b/libnet/src/libnet_resolve.c
index 9a78f1f..51039e1 100644
--- a/libnet/src/libnet_resolve.c
+++ b/libnet/src/libnet_resolve.c
@@ -127,7 +127,7 @@ libnet_name2addr4(libnet_t *l, char *host_name, uint8_t use_name)
if (!(host_ent = gethostbyname(host_name)))
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): %s\n", __func__, hstrerror(h_errno));
+ "%s(): %s", __func__, hstrerror(h_errno));
/* XXX - this is actually 255.255.255.255 */
return (-1);
}
@@ -146,7 +146,7 @@ libnet_name2addr4(libnet_t *l, char *host_name, uint8_t use_name)
if (l)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): expecting dots and decimals\n", __func__);
+ "%s(): expecting dots and decimals", __func__);
}
/* XXX - this is actually 255.255.255.255 */
return (-1);
@@ -168,7 +168,7 @@ libnet_name2addr4(libnet_t *l, char *host_name, uint8_t use_name)
if (l)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): value greater than 255\n", __func__);
+ "%s(): value greater than 255", __func__);
}
/* XXX - this is actually 255.255.255.255 */
return (-1);
@@ -244,7 +244,7 @@ libnet_name2addr6(libnet_t *l, const char *host_name, uint8_t use_name)
if (l)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): can't resolve IPv6 addresses\n", __func__);
+ "%s(): can't resolve IPv6 addresses", __func__);
}
return (in6addr_error);
#else
@@ -254,7 +254,7 @@ libnet_name2addr6(libnet_t *l, const char *host_name, uint8_t use_name)
sizeof(struct in_addr), AF_INET6, NULL)))
#else
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): %s\n", __func__, strerror(errno));
+ "%s(): %s", __func__, strerror(errno));
return (in6addr_error);
#endif
#else
@@ -275,7 +275,7 @@ libnet_name2addr6(libnet_t *l, const char *host_name, uint8_t use_name)
if (l)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): can't resolve IPv6 addresses.\n", __func__);
+ "%s(): can't resolve IPv6 addresses.", __func__);
}
return (in6addr_error);
#else
@@ -284,7 +284,7 @@ libnet_name2addr6(libnet_t *l, const char *host_name, uint8_t use_name)
if (l)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): invalid IPv6 address\n", __func__);
+ "%s(): invalid IPv6 address", __func__);
}
return (in6addr_error);
}
@@ -311,7 +311,7 @@ libnet_get_ipaddr6(libnet_t *l)
if (getifaddrs(&ifaddr) != 0)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): getifaddrs(): %s\n", __func__, strerror(errno));
+ "%s(): getifaddrs(): %s", __func__, strerror(errno));
return (in6addr_error);
}
@@ -344,7 +344,7 @@ struct libnet_in6_addr
libnet_get_ipaddr6(libnet_t *l)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): not yet Implemented\n", __func__);
+ "%s(): not yet Implemented", __func__);
return (in6addr_error);
}
#endif /* WIN32 */
@@ -367,7 +367,7 @@ libnet_get_ipaddr4(libnet_t *l)
if (fd == -1)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): socket(): %s\n", __func__, strerror(errno));
+ "%s(): socket(): %s", __func__, strerror(errno));
return (-1);
}
@@ -390,7 +390,7 @@ libnet_get_ipaddr4(libnet_t *l)
if (ioctl(fd, SIOCGIFADDR, (int8_t*) &ifr) < 0)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): ioctl(): %s\n", __func__, strerror(errno));
+ "%s(): ioctl(): %s", __func__, strerror(errno));
close(fd);
return (-1);
}
diff --git a/libnet/src/libnet_write.c b/libnet/src/libnet_write.c
index 6e6d1f3..a70022c 100644
--- a/libnet/src/libnet_write.c
+++ b/libnet/src/libnet_write.c
@@ -67,7 +67,7 @@ libnet_write(libnet_t *l)
if (len > LIBNET_MAX_PACKET)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): packet is too large (%d bytes)\n",
+ "%s(): packet is too large (%d bytes)",
__func__, len);
goto done;
}
@@ -83,7 +83,7 @@ libnet_write(libnet_t *l)
break;
default:
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): unsuported injection type\n", __func__);
+ "%s(): unsuported injection type", __func__);
goto done;
}
@@ -206,7 +206,7 @@ libnet_win32_write_raw_ipv4(libnet_t *l, const uint8_t *payload, uint32_t payloa
if (packet == NULL)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): failed to allocate packet\n", __func__);
+ "%s(): failed to allocate packet", __func__);
return (-1);
}
@@ -251,7 +251,7 @@ libnet_win32_write_raw_ipv4(libnet_t *l, const uint8_t *payload, uint32_t payloa
case NdisMediumArcnet878_2:
default:
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): network type (%d) is not supported\n", __func__,
+ "%s(): network type (%d) is not supported", __func__,
type.LinkType);
return (-1);
break;
@@ -261,7 +261,7 @@ libnet_win32_write_raw_ipv4(libnet_t *l, const uint8_t *payload, uint32_t payloa
if ((lpPacket = PacketAllocatePacket()) == NULL)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): failed to allocate the LPPACKET structure\n", __func__);
+ "%s(): failed to allocate the LPPACKET structure", __func__);
return (-1);
}
@@ -359,11 +359,11 @@ libnet_write_raw_ipv4(libnet_t *l, const uint8_t *packet, uint32_t size)
{
#if !(__WIN32__)
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): %d bytes written (%s)\n", __func__, c,
+ "%s(): %d bytes written (%s)", __func__, c,
strerror(errno));
#else /* __WIN32__ */
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): %d bytes written (%d)\n", __func__, c,
+ "%s(): %d bytes written (%d)", __func__, c,
WSAGetLastError());
#endif /* !__WIN32__ */
}
@@ -374,7 +374,7 @@ int
libnet_write_raw_ipv6(libnet_t *l, const uint8_t *packet, uint32_t size)
{
#if defined HAVE_SOLARIS && !defined HAVE_SOLARIS_IPV6
- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): no IPv6 support\n",
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): no IPv6 support",
__func__, strerror(errno));
return (-1);
}
@@ -400,11 +400,11 @@ libnet_write_raw_ipv6(libnet_t *l, const uint8_t *packet, uint32_t size)
{
#if !(__WIN32__)
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): %d bytes written (%s)\n", __func__, c,
+ "%s(): %d bytes written (%s)", __func__, c,
strerror(errno));
#else /* __WIN32__ */
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): %d bytes written (%d)\n", __func__, c,
+ "%s(): %d bytes written (%d)", __func__, c,
WSAGetLastError());
#endif /* !__WIN32__ */
}