Mark network control packets with DSCP CS6 (parity with ospfd)
authorjob <job@openbsd.org>
Wed, 15 May 2024 08:45:03 +0000 (08:45 +0000)
committerjob <job@openbsd.org>
Wed, 15 May 2024 08:45:03 +0000 (08:45 +0000)
OK claudio@

usr.sbin/ospf6d/ospfe.c

index a2a161a..0627ca7 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ospfe.c,v 1.71 2023/12/13 15:34:43 claudio Exp $ */
+/*     $OpenBSD: ospfe.c,v 1.72 2024/05/15 08:45:03 job Exp $ */
 
 /*
  * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -75,6 +75,7 @@ ospfe(struct ospfd_conf *xconf, int pipe_parent2ospfe[2], int pipe_ospfe2rde[2],
        struct passwd   *pw;
        struct event     ev_sigint, ev_sigterm;
        pid_t            pid;
+       int              pre = IPTOS_PREC_INTERNETCONTROL;
 
        switch (pid = fork()) {
        case -1:
@@ -90,6 +91,10 @@ ospfe(struct ospfd_conf *xconf, int pipe_parent2ospfe[2], int pipe_ospfe2rde[2],
            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)
                fatal("if_set_mcast_loop");