-/* $OpenBSD: bgpd.c,v 1.263 2024/04/09 12:05:07 claudio Exp $ */
+/* $OpenBSD: bgpd.c,v 1.264 2024/05/15 09:09:38 job Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
#include <sys/socket.h>
#include <sys/wait.h>
#include <netinet/in.h>
+#include <netinet/ip.h>
+#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <err.h>
#include <errno.h>
struct connect_elm *ce;
struct sockaddr *sa;
socklen_t len;
+ int nodelay = 1;
+ int pre = IPTOS_PREC_INTERNETCONTROL;
if (connect_cnt >= MAX_CONNECT_CNT) {
log_warnx("rtr %s: too many concurrent connection requests",
return;
}
+ switch (r->remote_addr.aid) {
+ case AID_INET:
+ if (setsockopt(ce->fd, IPPROTO_IP, IP_TOS, &pre, sizeof(pre)) ==
+ -1) {
+ log_warn("rtr %s: setsockopt IP_TOS", r->descr);
+ return;
+ }
+ break;
+ case AID_INET6:
+ if (setsockopt(ce->fd, IPPROTO_IPV6, IPV6_TCLASS, &pre,
+ sizeof(pre)) == -1) {
+ log_warn("rtr %s: setsockopt IP_TOS", r->descr);
+ return;
+ }
+ break;
+ }
+
+ if (setsockopt(ce->fd, IPPROTO_TCP, TCP_NODELAY, &nodelay,
+ sizeof(nodelay)) == -1) {
+ log_warn("rtr %s: setsockopt TCP_NODELAY", r->descr);
+ return;
+ }
+
imsg_compose(ibuf_rtr, IMSG_SOCKET_CONN, ce->id, 0, ce->fd, NULL, 0);
free(ce);
}
-/* $OpenBSD: session.c,v 1.474 2024/04/24 10:41:34 claudio Exp $ */
+/* $OpenBSD: session.c,v 1.475 2024/05/15 09:09:38 job Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
}
break;
case AID_INET6:
+ if (setsockopt(p->fd, IPPROTO_IPV6, IPV6_TCLASS, &pre,
+ sizeof(pre)) == -1) {
+ log_peer_warn(&p->conf, "session_setup_socket "
+ "setsockopt TCLASS");
+ return (-1);
+ }
+
if (p->conf.ebgp) {
/*
* set hoplimit to foreign router's distance