Re: svn commit: r365378 - head/usr.sbin/traceroute6

2020-09-06 Thread Alexey Dokuchaev
On Sun, Sep 06, 2020 at 08:32:46PM +0200, Oliver Pinter wrote:
> On Sunday, September 6, 2020, Mariusz Zaborski  wrote:
> > New Revision: 365378
> > URL: https://svnweb.freebsd.org/changeset/base/365378
> >
> > Log:
> >   traceroute6: capsicumize it
> >
> > ...
> > @@ -13,6 +13,10 @@
> >  # A PARTICULAR PURPOSE.
> >  # $FreeBSD$
> >
> > +.include 
> > +
> > +.include 
> 
> Dup

1) It's usually a good idea to read all svn-mail in your inbox before
replying to a particular commit, the problem could already be fixed;

2) Please don't overquote, i.e. do *not* include the rest of the diff
if you only wanted to comment on the first lines it.

./danfe
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r365378 - head/usr.sbin/traceroute6

2020-09-06 Thread Oliver Pinter
On Sunday, September 6, 2020, Mariusz Zaborski  wrote:

> Author: oshogbo
> Date: Sun Sep  6 14:04:02 2020
> New Revision: 365378
> URL: https://svnweb.freebsd.org/changeset/base/365378
>
> Log:
>   traceroute6: capsicumize it
>
>   Submitted by: Shubh Gupta 
>   Sponsored by: Google (GSOC 2020)
>   Differential Revision:https://reviews.freebsd.org/D25604
>
> Modified:
>   head/usr.sbin/traceroute6/Makefile
>   head/usr.sbin/traceroute6/traceroute6.c
>
> Modified: head/usr.sbin/traceroute6/Makefile
> 
> ==
> --- head/usr.sbin/traceroute6/Makefile  Sun Sep  6 11:29:06 2020
> (r365377)
> +++ head/usr.sbin/traceroute6/Makefile  Sun Sep  6 14:04:02 2020
> (r365378)
> @@ -13,6 +13,10 @@
>  # A PARTICULAR PURPOSE.
>  # $FreeBSD$
>
> +.include 
> +
> +.include 


Dup


> +
>  TRACEROUTE_DISTDIR?= ${SRCTOP}/contrib/traceroute
>  .PATH: ${TRACEROUTE_DISTDIR}
>
> @@ -26,7 +30,13 @@ BINMODE= 4555
>  CFLAGS+= -DIPSEC -DHAVE_POLL
>  CFLAGS+= -I${.CURDIR} -I${TRACEROUTE_DISTDIR} -I.
>
> -LIBADD=ipsec
> +.if ${MK_CASPER} != "no"
> +LIBADD+=   casper
> +LIBADD+=   cap_dns
> +CFLAGS+=   -DWITH_CASPER
> +.endif
> +
> +LIBADD+=   ipsec
>
>  .include 
>
>
> Modified: head/usr.sbin/traceroute6/traceroute6.c
> 
> ==
> --- head/usr.sbin/traceroute6/traceroute6.c Sun Sep  6 11:29:06 2020
>   (r365377)
> +++ head/usr.sbin/traceroute6/traceroute6.c Sun Sep  6 14:04:02 2020
>   (r365378)
> @@ -249,6 +249,7 @@ static const char rcsid[] =
>   */
>
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -260,6 +261,10 @@ static const char rcsid[] =
>
>  #include 
>
> +#include 
> +#include 
> +#include 
> +
>  #include 
>  #include 
>  #include 
> @@ -289,11 +294,6 @@ static const char rcsid[] =
>
>  #defineMAXPACKET   65535   /* max ip packet size */
>
> -#ifndef HAVE_GETIPNODEBYNAME
> -#define getipnodebyname(x, y, z, u)gethostbyname2((x), (y))
> -#define freehostent(x)
> -#endif
> -
>  static u_char  packet[512];/* last inbound (icmp) packet */
>  static char*outpacket; /* last output packet */
>
> @@ -304,6 +304,7 @@ int setpolicy(int so, char *policy);
>  #endif
>  void   send_probe(int, u_long);
>  void   *get_uphdr(struct ip6_hdr *, u_char *);
> +void   capdns_open(void);
>  intget_hoplim(struct msghdr *);
>  double deltaT(struct timeval *, struct timeval *);
>  const char *pr_type(int);
> @@ -312,6 +313,8 @@ voidprint(struct msghdr *, int);
>  const char *inetname(struct sockaddr *);
>  u_int32_t sctp_crc32c(void *, u_int32_t);
>  u_int16_t in_cksum(u_int16_t *addr, int);
> +u_int16_t udp_cksum(struct sockaddr_in6 *, struct sockaddr_in6 *,
> +void *, u_int32_t);
>  u_int16_t tcp_chksum(struct sockaddr_in6 *, struct sockaddr_in6 *,
>  void *, u_int32_t);
>  void   usage(void);
> @@ -335,6 +338,8 @@ static struct cmsghdr *cmsg;
>  static char *source = NULL;
>  static char *hostname;
>
> +static cap_channel_t *capdns;
> +
>  static u_long nprobes = 3;
>  static u_long first_hop = 1;
>  static u_long max_hops = 30;
> @@ -368,7 +373,10 @@ main(int argc, char *argv[])
> char ipsec_inpolicy[] = "in bypass";
> char ipsec_outpolicy[] = "out bypass";
>  #endif
> +   cap_rights_t rights;
>
> +   capdns_open();
> +
> /*
>  * Receive ICMP
>  */
> @@ -429,6 +437,7 @@ main(int argc, char *argv[])
> }
> break;
> case 'g':
> +   /* XXX use after capability mode is entered */
> hp = getipnodebyname(optarg, AF_INET6, 0,
> _errno);
> if (hp == NULL) {
> fprintf(stderr,
> @@ -560,8 +569,8 @@ main(int argc, char *argv[])
> sndsock = rcvsock;
> break;
> case IPPROTO_UDP:
> -   if ((sndsock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
> -   perror("socket(SOCK_DGRAM)");
> +   if ((sndsock = socket(AF_INET6, SOCK_RAW, IPPROTO_UDP)) <
> 0) {
> +   perror("socket(SOCK_RAW)");
> exit(5);
> }
> break;
> @@ -606,7 +615,9 @@ main(int argc, char *argv[])
> hints.ai_socktype = SOCK_RAW;
> hints.ai_protocol = IPPROTO_ICMPV6;
> hints.ai_flags = AI_CANONNAME;
> -   error = getaddrinfo(*argv, NULL, , );
> +
> +   error = cap_getaddrinfo(capdns, *argv, NULL, , );
> +
> if (error) {
> fprintf(stderr,
> "traceroute6: %s\n", gai_strerror(error));
> @@ -624,7 +635,7 @@ main(int argc, char *argv[])
> exit(1);
> }
> if (res->ai_next) {
> -   if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf,
> +   if