This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Undernet IRC Server Source Code.".

The branch, u2_10_12_branch has been updated
       via  b632d7552473bd071d535195ac1614fce490df46 (commit)
       via  5da1f3056298c89c6124a554f6912de4049d5404 (commit)
       via  8734346c94c8aba65c059f9b045871c5c655de22 (commit)
       via  b5819a0550f544236330015b47627b5a652344f0 (commit)
      from  7572ce31e4730c8b3b64d9b589a743166aa4f402 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b632d7552473bd071d535195ac1614fce490df46
Author: Michael Poole <[email protected]>
Date:   Sat Apr 15 23:14:21 2017 -0400

    os_set_tos: Use address family to pick right option.

diff --git a/include/ircd_osdep.h b/include/ircd_osdep.h
index 89579c0..309885a 100644
--- a/include/ircd_osdep.h
+++ b/include/ircd_osdep.h
@@ -52,7 +52,7 @@ extern int os_set_listen(int fd, int backlog);
 extern int os_set_nonblocking(int fd);
 extern int os_set_reuseaddr(int fd);
 extern int os_set_sockbufs(int fd, unsigned int ssize, unsigned int rsize);
-extern int os_set_tos(int fd,int tos);
+extern int os_set_tos(int fd, int tos, int family);
 extern int os_socketpair(int sv[2]);
 
 #endif /* INCLUDED_ircd_osdep_h */
diff --git a/ircd/listener.c b/ircd/listener.c
index dfe7804..479e84c 100644
--- a/ircd/listener.c
+++ b/ircd/listener.c
@@ -195,9 +195,10 @@ void show_ports(struct Client* sptr, const struct 
StatDesc* sd,
 /** Set or update socket options for \a listener.
  * @param[in] listener Listener to determine socket option values.
  * @param[in] fd File descriptor being updated.
+ * @param[in] family Address family for \a fd.
  * @return Non-zero on success, zero on failure.
  */
-static int set_listener_options(struct Listener *listener, int fd)
+static int set_listener_options(struct Listener *listener, int fd, int family)
 {
   int is_server;
 
@@ -220,7 +221,7 @@ static int set_listener_options(struct Listener *listener, 
int fd)
   /*
    * Set the TOS bits - this is nonfatal if it doesn't stick.
    */
-  if (!os_set_tos(fd,feature_int(is_server ? FEAT_TOS_SERVER : 
FEAT_TOS_CLIENT))) {
+  if (!os_set_tos(fd, feature_int(is_server ? FEAT_TOS_SERVER : 
FEAT_TOS_CLIENT), family)) {
     report_error(TOS_ERROR_MSG, get_listener_name(listener), errno);
   }
 
@@ -248,7 +249,7 @@ static int inetport(struct Listener* listener, int family)
     close(fd);
     return -1;
   }
-  if (!set_listener_options(listener, fd))
+  if (!set_listener_options(listener, fd, family))
     return -1;
   sock = (family == AF_INET) ? &listener->socket_v4 : &listener->socket_v6;
   if (!socket_add(sock, accept_connection, (void*) listener,
@@ -324,7 +325,7 @@ void add_listener(int port, const char* vhost_ip, const 
char* mask,
   if (FlagHas(&listener->flags, LISTEN_IPV6)
       && (irc_in_addr_unspec(&vaddr) || !irc_in_addr_is_ipv4(&vaddr))) {
     if (listener->fd_v6 >= 0) {
-      set_listener_options(listener, listener->fd_v6);
+      set_listener_options(listener, listener->fd_v6, AF_INET6);
       okay = 1;
     } else if ((fd = inetport(listener, AF_INET6)) >= 0) {
       listener->fd_v6 = fd;
@@ -340,7 +341,7 @@ void add_listener(int port, const char* vhost_ip, const 
char* mask,
   if (FlagHas(&listener->flags, LISTEN_IPV4)
       && (irc_in_addr_unspec(&vaddr) || irc_in_addr_is_ipv4(&vaddr))) {
     if (listener->fd_v4 >= 0) {
-      set_listener_options(listener, listener->fd_v4);
+      set_listener_options(listener, listener->fd_v4, AF_INET);
       okay = 1;
     } else if ((fd = inetport(listener, AF_INET)) >= 0) {
       listener->fd_v4 = fd;
diff --git a/ircd/os_generic.c b/ircd/os_generic.c
index 9ddb3c4..cd38d40 100644
--- a/ircd/os_generic.c
+++ b/ircd/os_generic.c
@@ -369,16 +369,22 @@ int os_set_sockbufs(int fd, unsigned int ssize, unsigned 
int rsize)
 /** Set a socket's "type of service" value.
  * @param[in] fd %Socket file descriptor to manipulate.
  * @param[in] tos New type of service value to use.
+ * @param[in] family Address family of \a fd (AF_INET or AF_INET6).
  * @return Non-zero on success, or zero on failure.
  */
-int os_set_tos(int fd,int tos)
+int os_set_tos(int fd, int tos, int family)
 {
+  if (family == AF_INET) {
 #if defined(IP_TOS) && defined(IPPROTO_IP)
-  unsigned int opt = tos;
-  return (0 == setsockopt(fd, IPPROTO_IP, IP_TOS, &opt, sizeof(opt)));
-#else
-  return 1;
+    return (0 == setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)));
+#endif
+#if defined(AF_INET6) && defined(IPV6_TCLASS) && defined(IPPROTO_IPV6)
+  } else if (family == AF_INET6) {
+    return (0 == setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos)));
 #endif
+  }
+
+  return 1;
 }
 
 /** Disable IP options on a socket.
diff --git a/ircd/s_bsd.c b/ircd/s_bsd.c
index 185ca4f..12fb935 100644
--- a/ircd/s_bsd.c
+++ b/ircd/s_bsd.c
@@ -219,6 +219,12 @@ static int connect_inet(struct ConfItem* aconf, struct 
Client* cptr)
   cli_fd(cptr) = os_socket(local, SOCK_STREAM, cli_name(cptr), family);
   if (cli_fd(cptr) < 0)
     return 0;
+#ifdef AF_INET6
+  if ((family == 0) && !irc_in_addr_is_ipv4(&local->addr))
+    family = AF_INET6;
+  else
+#endif
+    family = AF_INET;
 
   /*
    * save connection info in client
@@ -238,7 +244,7 @@ static int connect_inet(struct ConfItem* aconf, struct 
Client* cptr)
   /*
    * Set the TOS bits - this is nonfatal if it doesn't stick.
    */
-  if (!os_set_tos(cli_fd(cptr), feature_int(FEAT_TOS_SERVER))) {
+  if (!os_set_tos(cli_fd(cptr), feature_int(FEAT_TOS_SERVER), family)) {
     report_error(TOS_ERROR_MSG, cli_name(cptr), errno);
   }
   if ((result = os_connect_nonb(cli_fd(cptr), &aconf->address)) == IO_FAILURE) 
{
commit 5da1f3056298c89c6124a554f6912de4049d5404
Author: Michael Poole <[email protected]>
Date:   Sat Apr 15 23:13:59 2017 -0400

    mr_server: Use labs(time_diff) instead of abs().

diff --git a/ircd/m_server.c b/ircd/m_server.c
index aae44c5..70b9c43 100644
--- a/ircd/m_server.c
+++ b/ircd/m_server.c
@@ -640,7 +640,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int 
parc, char* parv[])
   ret = server_estab(cptr, aconf);
 
   if (feature_bool(FEAT_RELIABLE_CLOCK) &&
-      abs(cli_serv(cptr)->timestamp - recv_time) > 30) {
+      labs(cli_serv(cptr)->timestamp - recv_time) > 30) {
     sendto_opmask_butone(0, SNO_OLDSNO, "Connected to a net with a "
                         "timestamp-clock difference of %Td seconds! "
                         "Used SETTIME to correct this.",
commit 8734346c94c8aba65c059f9b045871c5c655de22
Author: Michael Poole <[email protected]>
Date:   Sat Apr 15 23:13:31 2017 -0400

    gline: Remove extraneous condition.
    
    cli_user(acptr)->username is a char[], thus never null.

diff --git a/ircd/gline.c b/ircd/gline.c
index 0885f27..ae8f5a2 100644
--- a/ircd/gline.c
+++ b/ircd/gline.c
@@ -224,8 +224,7 @@ do_gline(struct Client *cptr, struct Client *sptr, struct 
Gline *gline)
             continue;
         Debug((DEBUG_DEBUG,"Matched!"));
       } else { /* Host/IP gline */
-        if (cli_user(acptr)->username &&
-            match(gline->gl_user, (cli_user(acptr))->username) != 0)
+        if (match(gline->gl_user, (cli_user(acptr))->username) != 0)
           continue;
 
         if (GlineIsIpMask(gline)) {
commit b5819a0550f544236330015b47627b5a652344f0
Author: Michael Poole <[email protected]>
Date:   Mon Apr 3 20:45:10 2017 -0400

    s_auth: Do not send server hostnames or IPs over the network.

diff --git a/ircd/s_auth.c b/ircd/s_auth.c
index 8fe68da..53ed3ff 100644
--- a/ircd/s_auth.c
+++ b/ircd/s_auth.c
@@ -973,12 +973,19 @@ static void auth_dns_callback(void* vptr, const struct 
irc_in_addr *addr, const
   } else if (!irc_in_addr_valid(addr)
              || (irc_in_addr_cmp(&cli_ip(auth->client), addr)
                  && irc_in_addr_cmp(&auth->original, addr))) {
-    /* IP for hostname did not match client's IP. */
-    sendto_opmask_butone(0, SNO_IPMISMATCH, "IP# Mismatch: %s != %s[%s]",
-                         cli_sock_ip(auth->client), h_name,
-                         ircd_ntoa(addr));
-    if (IsUserPort(auth->client))
+    if (IsUserPort(auth->client)) {
+      /* IP for hostname did not match client's IP. */
+      sendto_opmask_butone(0, SNO_IPMISMATCH, "IP# Mismatch: %s != %s[%s]",
+                           cli_sock_ip(auth->client), h_name,
+                           ircd_ntoa(addr));
       sendheader(auth->client, REPORT_IP_MISMATCH);
+    } else {
+      /* Mismatch for a server, do not send to opers. */
+      log_write(LS_NETWORK, L_NOTICE, LOG_NOSNOTICE,
+                "IP# Mismatch: %s != %s[%s]",
+                cli_sock_ip(auth->client), h_name,
+                ircd_ntoa(addr));
+    }
     if (feature_bool(FEAT_KILL_IPMISMATCH)) {
       exit_client(auth->client, auth->client, &me, "IP mismatch");
       return;
-----------------------------------------------------------------------

Summary of changes:
 include/ircd_osdep.h |  2 +-
 ircd/gline.c         |  3 +--
 ircd/listener.c      | 11 ++++++-----
 ircd/m_server.c      |  2 +-
 ircd/os_generic.c    | 16 +++++++++++-----
 ircd/s_auth.c        | 17 ++++++++++++-----
 ircd/s_bsd.c         |  8 +++++++-
 7 files changed, 39 insertions(+), 20 deletions(-)


hooks/post-receive
-- 
Undernet IRC Server Source Code.
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to