Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
Re: ospf6d: mark packets with DSCP CS6
To:
Job Snijders <job@openbsd.org>
Cc:
tech@openbsd.org
Date:
Wed, 15 May 2024 10:39:51 +0200

Download raw body.

Thread
On Tue, May 14, 2024 at 03:28:29PM +0000, Job Snijders wrote:
> The same is done in ospfd/packet.c:73
> 
> OK?

All other sockopts are done in interface.c as e.g.
if_set_ipv6_pktinfo() or if_set_ipv6_checksum().

But those functions are called only once so it feels a but overkill to do
that. So OK claudio@
 
> Index: ospfe.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospf6d/ospfe.c,v
> diff -u -p -r1.71 ospfe.c
> --- ospfe.c	13 Dec 2023 15:34:43 -0000	1.71
> +++ ospfe.c	14 May 2024 15:26:32 -0000
> @@ -75,6 +75,7 @@ ospfe(struct ospfd_conf *xconf, int pipe
>  	struct passwd	*pw;
>  	struct event	 ev_sigint, ev_sigterm;
>  	pid_t		 pid;
> +	int		 pre = IPTOS_PREC_INTERNETCONTROL;
>  
>  	switch (pid = fork()) {
>  	case -1:
> @@ -89,6 +90,10 @@ ospfe(struct ospfd_conf *xconf, int pipe
>  	if ((xconf->ospf_socket = socket(AF_INET6,
>  	    SOCK_RAW | SOCK_CLOEXEC | SOCK_NONBLOCK, IPPROTO_OSPF)) == -1)
>  		fatal("error creating raw socket");
> +
> +	if (setsockopt(xconf->ospf_socket, IPPROTO_IPV6, IPV6_TCLASS, &pre,
> +	    sizeof(pre)) == -1)
> +		fatal("setsockopt IPV6_TCLASS");
>  
>  	/* set some defaults */
>  	if (if_set_mcast_loop(xconf->ospf_socket) == -1)
> 

-- 
:wq Claudio