Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144401159
D25603.id74251.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D25603.id74251.diff
View Options
Index: usr.sbin/traceroute6/Makefile
===================================================================
--- usr.sbin/traceroute6/Makefile
+++ usr.sbin/traceroute6/Makefile
@@ -26,8 +26,8 @@
CFLAGS+= -DIPSEC -DHAVE_POLL
CFLAGS+= -I${.CURDIR} -I${TRACEROUTE_DISTDIR} -I.
-WARNS?= 3
-
LIBADD= ipsec
.include <bsd.prog.mk>
+
+CWARNFLAGS+= -Wno-cast-align
Index: usr.sbin/traceroute6/traceroute6.c
===================================================================
--- usr.sbin/traceroute6/traceroute6.c
+++ usr.sbin/traceroute6/traceroute6.c
@@ -294,8 +294,8 @@
#define freehostent(x)
#endif
-u_char packet[512]; /* last inbound (icmp) packet */
-char *outpacket; /* last output packet */
+static u_char packet[512]; /* last inbound (icmp) packet */
+static char *outpacket; /* last output packet */
int main(int, char *[]);
int wait_for_reply(int, struct msghdr *);
@@ -318,40 +318,40 @@
void *, u_int32_t);
void usage(void);
-int rcvsock; /* receive (icmp) socket file descriptor */
-int sndsock; /* send (raw/udp) socket file descriptor */
+static int rcvsock; /* receive (icmp) socket file descriptor */
+static int sndsock; /* send (raw/udp) socket file descriptor */
-struct msghdr rcvmhdr;
-struct iovec rcviov[2];
-int rcvhlim;
-struct in6_pktinfo *rcvpktinfo;
+static struct msghdr rcvmhdr;
+static struct iovec rcviov[2];
+static int rcvhlim;
+static struct in6_pktinfo *rcvpktinfo;
-struct sockaddr_in6 Src, Dst, Rcv;
-u_long datalen = 20; /* How much data */
+static struct sockaddr_in6 Src, Dst, Rcv;
+static u_long datalen = 20; /* How much data */
#define ICMP6ECHOLEN 8
/* XXX: 2064 = 127(max hops in type 0 rthdr) * sizeof(ip6_hdr) + 16(margin) */
-char rtbuf[2064];
-struct ip6_rthdr *rth;
-struct cmsghdr *cmsg;
-
-char *source = NULL;
-char *hostname;
-
-u_long nprobes = 3;
-u_long first_hop = 1;
-u_long max_hops = 30;
-u_int16_t srcport;
-u_int16_t port = 32768+666; /* start udp dest port # for probe packets */
-u_int16_t ident;
-int options; /* socket options */
-int verbose;
-int waittime = 5; /* time to wait for response (in seconds) */
-int nflag; /* print addresses numerically */
-int useproto = IPPROTO_UDP; /* protocol to use to send packet */
-int lflag; /* print both numerical address & hostname */
-int as_path; /* print as numbers for each hop */
-char *as_server = NULL;
-void *asn;
+static char rtbuf[2064];
+static struct ip6_rthdr *rth;
+static struct cmsghdr *cmsg;
+
+static char *source = NULL;
+static char *hostname;
+
+static u_long nprobes = 3;
+static u_long first_hop = 1;
+static u_long max_hops = 30;
+static u_int16_t srcport;
+static u_int16_t port = 32768+666; /* start udp dest port # for probe packets */
+static u_int16_t ident;
+static int options; /* socket options */
+static int verbose;
+static int waittime = 5; /* time to wait for response (in seconds) */
+static int nflag; /* print addresses numerically */
+static int useproto = IPPROTO_UDP; /* protocol to use to send packet */
+static int lflag; /* print both numerical address & hostname */
+static int as_path; /* print as numbers for each hop */
+static char *as_server = NULL;
+static void *asn;
int
main(int argc, char *argv[])
@@ -366,6 +366,8 @@
size_t size, minlen;
uid_t uid;
u_char type, code;
+ char ipssp_inbypass[10] = "in bypass"; /* used to set the policy in ipsec set policy as "in bypass" */
+ char ipssp_outbypass[11] = "out bypass"; /* used to set the policy in ipsec set policy as "out bypass" */
/*
* Receive ICMP
@@ -711,9 +713,9 @@
* do not raise error even if setsockopt fails, kernel may have ipsec
* turned off.
*/
- if (setpolicy(rcvsock, "in bypass") < 0)
+ if (setpolicy(rcvsock, ipssp_inbypass) < 0)
errx(1, "%s", ipsec_strerror());
- if (setpolicy(rcvsock, "out bypass") < 0)
+ if (setpolicy(rcvsock, ipssp_outbypass) < 0)
errx(1, "%s", ipsec_strerror());
#else
{
@@ -769,9 +771,9 @@
* do not raise error even if setsockopt fails, kernel may have ipsec
* turned off.
*/
- if (setpolicy(sndsock, "in bypass") < 0)
+ if (setpolicy(sndsock, ipssp_inbypass) < 0)
errx(1, "%s", ipsec_strerror());
- if (setpolicy(sndsock, "out bypass") < 0)
+ if (setpolicy(sndsock, ipssp_outbypass) < 0)
errx(1, "%s", ipsec_strerror());
#else
{
@@ -801,25 +803,25 @@
*/
bzero(&Src, sizeof(Src));
if (source) {
- struct addrinfo hints, *res;
- int error;
-
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = AF_INET6;
- hints.ai_socktype = SOCK_DGRAM; /*dummy*/
- hints.ai_flags = AI_NUMERICHOST;
- error = getaddrinfo(source, "0", &hints, &res);
- if (error) {
+ struct addrinfo lc_hints, *lc_res; /* here the lc keyword specifies the variable to be local to this scope */
+ int lc_error;
+
+ memset(&lc_hints, 0, sizeof(lc_hints));
+ lc_hints.ai_family = AF_INET6;
+ lc_hints.ai_socktype = SOCK_DGRAM; /*dummy*/
+ lc_hints.ai_flags = AI_NUMERICHOST;
+ lc_error = getaddrinfo(source, "0", &lc_hints, &lc_res);
+ if (lc_error) {
printf("traceroute6: %s: %s\n", source,
- gai_strerror(error));
+ gai_strerror(lc_error));
exit(1);
}
- if (res->ai_addrlen > sizeof(Src)) {
+ if (lc_res->ai_addrlen > sizeof(Src)) {
printf("traceroute6: %s: %s\n", source,
- gai_strerror(error));
+ gai_strerror(lc_error));
exit(1);
}
- memcpy(&Src, res->ai_addr, res->ai_addrlen);
+ memcpy(&Src, lc_res->ai_addr, lc_res->ai_addrlen);
freeaddrinfo(res);
} else {
struct sockaddr_in6 Nxt;
@@ -1627,11 +1629,11 @@
};
u_int32_t
-sctp_crc32c(void *packet, u_int32_t len)
+sctp_crc32c(void *pack, u_int32_t len)
{
u_int32_t i, crc32c;
u_int8_t byte0, byte1, byte2, byte3;
- u_int8_t *buf = (u_int8_t *)packet;
+ u_int8_t *buf = (u_int8_t *)pack;
crc32c = ~0;
for (i = 0; i < len; i++)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 9, 6:15 AM (1 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28517602
Default Alt Text
D25603.id74251.diff (5 KB)
Attached To
Mode
D25603: traceroute6: Fix most of the warnings at the default WARNS level
Attached
Detach File
Event Timeline
Log In to Comment