Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netatalk atalk(4): Omit spurious satosat.



details:   https://anonhg.NetBSD.org/src/rev/523aa54954f4
branches:  trunk
changeset: 374084:523aa54954f4
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 30 17:48:10 2023 +0000

description:
atalk(4): Omit spurious satosat.

The input is already a struct sockaddr_at pointer.

diffstat:

 sys/compat/common/if_43.c |  19 ++++++++++++++-----
 sys/netatalk/ddp_output.c |   6 +++---
 2 files changed, 17 insertions(+), 8 deletions(-)

diffs (78 lines):

diff -r b6b1506b8ad2 -r 523aa54954f4 sys/compat/common/if_43.c
--- a/sys/compat/common/if_43.c Thu Mar 30 15:58:21 2023 +0000
+++ b/sys/compat/common/if_43.c Thu Mar 30 17:48:10 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_43.c,v 1.26 2022/09/28 15:32:09 msaitoh Exp $       */
+/*     $NetBSD: if_43.c,v 1.27 2023/03/30 17:48:10 riastradh Exp $     */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.26 2022/09/28 15:32:09 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.27 2023/03/30 17:48:10 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -254,20 +254,29 @@ compat_ifioctl(struct socket *so, u_long
        }
 
        switch (ocmd) {
+               enum { maxlen = sizeof(oifr->ifr_ifru) };
+               CTASSERT(maxlen == 16);
+               socklen_t famlen;
        case OSIOCSIFADDR:
        case OSIOCSIFDSTADDR:
        case OSIOCSIFBRDADDR:
        case OSIOCSIFNETMASK:
                sa = &ifr->ifr_addr;
 #if BYTE_ORDER != BIG_ENDIAN
-               if (sa->sa_family == 0 && sa->sa_len < 16) {
+               if (sa->sa_family == 0 && sa->sa_len < maxlen) {
                        sa->sa_family = sa->sa_len;
-                       sa->sa_len = 16;
+                       sa->sa_len = maxlen;
                }
 #else
                if (sa->sa_len == 0)
-                       sa->sa_len = 16;
+                       sa->sa_len = maxlen;
 #endif
+               famlen = sockaddr_getsize_by_family(sa->sa_family);
+               if (famlen > sa->sa_len) {
+                       curlwp_bindx(bound);
+                       return EAFNOSUPPORT;
+               }
+
                break;
        }
 
diff -r b6b1506b8ad2 -r 523aa54954f4 sys/netatalk/ddp_output.c
--- a/sys/netatalk/ddp_output.c Thu Mar 30 15:58:21 2023 +0000
+++ b/sys/netatalk/ddp_output.c Thu Mar 30 17:48:10 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ddp_output.c,v 1.21 2018/02/17 19:10:18 rjs Exp $       */
+/*     $NetBSD: ddp_output.c,v 1.22 2023/03/30 17:48:10 riastradh Exp $         */
 
 /*
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ddp_output.c,v 1.21 2018/02/17 19:10:18 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ddp_output.c,v 1.22 2023/03/30 17:48:10 riastradh Exp $");
 #include "opt_atalk.h"
 
 #include <sys/param.h>
@@ -172,7 +172,7 @@ ddp_route(struct mbuf *m, struct route *
                }
 
                elh = mtod(m, struct elaphdr *);
-               elh->el_snode = satosat(&aa->aa_addr)->sat_addr.s_node;
+               elh->el_snode = aa->aa_addr.sat_addr.s_node;
                elh->el_type = ELAP_DDPEXTEND;
                if (ntohs(satocsat(rtcache_getdst(ro))->sat_addr.s_net) >=
                    ntohs(aa->aa_firstnet) &&



Home | Main Index | Thread Index | Old Index