diff options
author | Sebastian Benoit <benno@cvs.openbsd.org> | 2017-05-28 10:06:14 +0000 |
---|---|---|
committer | Sebastian Benoit <benno@cvs.openbsd.org> | 2017-05-28 10:06:14 +0000 |
commit | 765aa58e1c0ceead4ec5df1539b6698b7ef3039c (patch) | |
tree | 9e0db665b5d96e0aae0d95ae00ea8c37aa98ef59 /usr.sbin/traceroute | |
parent | b78bd94fdace6b07e5ab16c863686d266734f406 (diff) |
style(9) some variable declarations
ok florian@
Diffstat (limited to 'usr.sbin/traceroute')
-rw-r--r-- | usr.sbin/traceroute/traceroute.c | 89 | ||||
-rw-r--r-- | usr.sbin/traceroute/traceroute.h | 35 |
2 files changed, 58 insertions, 66 deletions
diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c index 72bd3b86bee..96a0bd15aa9 100644 --- a/usr.sbin/traceroute/traceroute.c +++ b/usr.sbin/traceroute/traceroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: traceroute.c,v 1.154 2017/05/28 10:04:27 benno Exp $ */ +/* $OpenBSD: traceroute.c,v 1.155 2017/05/28 10:06:13 benno Exp $ */ /* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */ /* @@ -283,49 +283,50 @@ void usage(int); int main(int argc, char *argv[]) { - int mib[4] = { CTL_NET, PF_INET, IPPROTO_IP, IPCTL_DEFTTL }; - - int ch, i; - int on = 1; - int probe; - int seq = 0; - int error; - int packetlen; - int rcvcmsglen; - int curwaittime; - int rcvsock4, rcvsock6, sndsock4, sndsock6; - int v4sock_errno, v6sock_errno; - struct addrinfo hints, *res; - struct passwd *pw; - size_t size; - static u_char *rcvcmsgbuf; - struct sockaddr_in from4, to4; - struct sockaddr_in6 from6, to6; - struct sockaddr *from, *to; - struct hostent *hp; - u_int32_t tmprnd; - struct ip *ip = NULL; - u_int8_t ttl; - char hbuf[NI_MAXHOST]; - char *dest; - const char *errstr; - long l; - uid_t ouid, uid; - gid_t gid; - int last_tos = 0; - - socklen_t len; - - int headerlen; /* How long packet's header is */ - - int xflag = 0; /* show ICMP extension header */ - int v6flag = 0; - - struct msghdr rcvmhdr; - struct iovec rcviov[2]; - - /* configuration defaults */ - struct tr_conf *conf; + int mib[4] = { CTL_NET, PF_INET, IPPROTO_IP, IPCTL_DEFTTL }; + char hbuf[NI_MAXHOST]; + + struct tr_conf *conf; /* configuration defaults */ + struct sockaddr_in from4, to4; + struct sockaddr_in6 from6, to6; + struct sockaddr *from, *to; + struct addrinfo hints, *res; + struct hostent *hp; + struct ip *ip = NULL; + struct iovec rcviov[2]; + struct msghdr rcvmhdr; + static u_char *rcvcmsgbuf; + struct passwd *pw; + + long l; + socklen_t len; + size_t size; + + int ch; + int on = 1; + int seq = 0; + int error; + int curwaittime; + int headerlen; /* How long packet's header is */ + int i; + int last_tos = 0; + int packetlen; + int probe; + int rcvcmsglen; + int rcvsock4, rcvsock6; + int sndsock4, sndsock6; + u_int32_t tmprnd; + int v4sock_errno, v6sock_errno; + int v6flag = 0; + int xflag = 0; /* show ICMP extension header */ + + char *dest; + const char *errstr; + u_int8_t ttl; + + uid_t ouid, uid; + gid_t gid; + if ((conf = calloc(1, sizeof(*conf))) == NULL) err(1,NULL); diff --git a/usr.sbin/traceroute/traceroute.h b/usr.sbin/traceroute/traceroute.h index 6cb4b39f527..e8dd831359c 100644 --- a/usr.sbin/traceroute/traceroute.h +++ b/usr.sbin/traceroute/traceroute.h @@ -1,4 +1,4 @@ -/* $OpenBSD: traceroute.h,v 1.4 2017/05/28 10:04:27 benno Exp $ */ +/* $OpenBSD: traceroute.h,v 1.5 2017/05/28 10:06:13 benno Exp $ */ /* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */ /* @@ -87,38 +87,29 @@ struct packetdata { } __packed; struct tr_conf { - int verbose; - - u_short ident; - int incflag; /* Do not inc the dest. port num */ - int dflag; /* set SO_DEBUG */ - int dump; - int Aflag; /* lookup ASN */ int first_ttl; /* Set the first TTL or hop limit */ - u_char proto; /* IP payload protocol to use */ + u_int8_t max_ttl; /* Set the maximum TTL / hop limit */ + int nprobes; + u_int16_t port; /* start udp dest port */ + int waittime; /* time to wait for a response */ + int Aflag; /* lookup ASN */ + int dflag; /* set SO_DEBUG */ + int dump; + int lsrr; /* Loose Source Record Route */ + struct in_addr gateway[MAX_LSRR + 1]; + int lsrrlen; int protoset; - int ttl_flag; /* display ttl on returned packet */ - u_int8_t max_ttl; /* Set the maximum TTL / hop limit */ int nflag; /* print addresses numerically */ - - u_int16_t port; /* start udp dest port */ - int nprobes; char *source; int sump; - int tos; int tflag; /* tos value was set */ - + int verbose; u_int rtableid; /* Set the routing table */ - - int waittime; /* time to wait for a response */ - - int lsrr; /* Loose Source Record Route */ - int lsrrlen; - struct in_addr gateway[MAX_LSRR + 1]; + u_short ident; }; extern int32_t sec_perturb; |