CVS commit: src/sys/netatalk

2023-07-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jul 31 01:24:36 UTC 2023

Modified Files:
src/sys/netatalk: aarp.c

Log Message:
aarp.c: one more thing -- both macro params should get parens


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/netatalk/aarp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netatalk/aarp.c
diff -u src/sys/netatalk/aarp.c:1.45 src/sys/netatalk/aarp.c:1.46
--- src/sys/netatalk/aarp.c:1.45	Mon Jul 31 01:23:04 2023
+++ src/sys/netatalk/aarp.c	Mon Jul 31 01:24:36 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: aarp.c,v 1.45 2023/07/31 01:23:04 dholland Exp $	*/
+/*	$NetBSD: aarp.c,v 1.46 2023/07/31 01:24:36 dholland Exp $	*/
 
 /*
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aarp.c,v 1.45 2023/07/31 01:23:04 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aarp.c,v 1.46 2023/07/31 01:24:36 dholland Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_atalk.h"
@@ -73,14 +73,14 @@ struct aarptab  aarptab[AARPTAB_SIZE];
 #define AARPTAB_LOOK(aat, addr) { \
 	int n;			\
 \
-	aat = &aarptab[AARPTAB_HASH(addr) * AARPTAB_BSIZ];	\
-	for (n = 0; n < AARPTAB_BSIZ; n++, aat++) {		\
-		if (aat->aat_ataddr.s_net == (addr).s_net &&	\
-	aat->aat_ataddr.s_node == (addr).s_node)	\
+	(aat) = &aarptab[AARPTAB_HASH(addr) * AARPTAB_BSIZ];	\
+	for (n = 0; n < AARPTAB_BSIZ; n++, (aat)++) {		\
+		if ((aat)->aat_ataddr.s_net == (addr).s_net &&	\
+	(aat)->aat_ataddr.s_node == (addr).s_node)	\
 			break;	\
 	}			\
 	if (n >= AARPTAB_BSIZ) {\
-		aat = 0;	\
+		(aat) = 0;	\
 	}			\
 }
 



CVS commit: src/sys/netatalk

2023-07-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jul 31 01:24:36 UTC 2023

Modified Files:
src/sys/netatalk: aarp.c

Log Message:
aarp.c: one more thing -- both macro params should get parens


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/netatalk/aarp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/netatalk

2023-07-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jul 31 01:23:04 UTC 2023

Modified Files:
src/sys/netatalk: aarp.c

Log Message:
aarp.c: whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/netatalk/aarp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/netatalk

2023-07-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jul 31 01:23:04 UTC 2023

Modified Files:
src/sys/netatalk: aarp.c

Log Message:
aarp.c: whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/netatalk/aarp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netatalk/aarp.c
diff -u src/sys/netatalk/aarp.c:1.44 src/sys/netatalk/aarp.c:1.45
--- src/sys/netatalk/aarp.c:1.44	Mon Jul 31 01:19:49 2023
+++ src/sys/netatalk/aarp.c	Mon Jul 31 01:23:04 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: aarp.c,v 1.44 2023/07/31 01:19:49 dholland Exp $	*/
+/*	$NetBSD: aarp.c,v 1.45 2023/07/31 01:23:04 dholland Exp $	*/
 
 /*
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aarp.c,v 1.44 2023/07/31 01:19:49 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aarp.c,v 1.45 2023/07/31 01:23:04 dholland Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_atalk.h"
@@ -70,17 +70,18 @@ struct aarptab  aarptab[AARPTAB_SIZE];
 #define AARPTAB_HASH(a) \
 a).s_net << 8 ) + (a).s_node ) % AARPTAB_NB )
 
-#define AARPTAB_LOOK(aat,addr) { \
-int		n; \
-aat = &aarptab[ AARPTAB_HASH(addr) * AARPTAB_BSIZ ]; \
-for ( n = 0; n < AARPTAB_BSIZ; n++, aat++ ) { \
-	if ( aat->aat_ataddr.s_net == (addr).s_net && \
-	 aat->aat_ataddr.s_node == (addr).s_node ) \
-	break; \
-} \
-if ( n >= AARPTAB_BSIZ ) { \
-	aat = 0; \
-} \
+#define AARPTAB_LOOK(aat, addr) { \
+	int n;			\
+\
+	aat = &aarptab[AARPTAB_HASH(addr) * AARPTAB_BSIZ];	\
+	for (n = 0; n < AARPTAB_BSIZ; n++, aat++) {		\
+		if (aat->aat_ataddr.s_net == (addr).s_net &&	\
+	aat->aat_ataddr.s_node == (addr).s_node)	\
+			break;	\
+	}			\
+	if (n >= AARPTAB_BSIZ) {\
+		aat = 0;	\
+	}			\
 }
 
 #define AARPT_AGE	(60 * 1)



CVS commit: src/sys/netatalk

2023-07-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jul 31 01:19:50 UTC 2023

Modified Files:
src/sys/netatalk: aarp.c

Log Message:
aarp.c: fix wrong indent and add missing braces inside macro


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/netatalk/aarp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netatalk/aarp.c
diff -u src/sys/netatalk/aarp.c:1.43 src/sys/netatalk/aarp.c:1.44
--- src/sys/netatalk/aarp.c:1.43	Sat Dec 22 14:28:56 2018
+++ src/sys/netatalk/aarp.c	Mon Jul 31 01:19:49 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: aarp.c,v 1.43 2018/12/22 14:28:56 maxv Exp $	*/
+/*	$NetBSD: aarp.c,v 1.44 2023/07/31 01:19:49 dholland Exp $	*/
 
 /*
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aarp.c,v 1.43 2018/12/22 14:28:56 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aarp.c,v 1.44 2023/07/31 01:19:49 dholland Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_atalk.h"
@@ -73,12 +73,14 @@ struct aarptab  aarptab[AARPTAB_SIZE];
 #define AARPTAB_LOOK(aat,addr) { \
 int		n; \
 aat = &aarptab[ AARPTAB_HASH(addr) * AARPTAB_BSIZ ]; \
-for ( n = 0; n < AARPTAB_BSIZ; n++, aat++ ) \
+for ( n = 0; n < AARPTAB_BSIZ; n++, aat++ ) { \
 	if ( aat->aat_ataddr.s_net == (addr).s_net && \
 	 aat->aat_ataddr.s_node == (addr).s_node ) \
 	break; \
-	if ( n >= AARPTAB_BSIZ ) \
-	aat = 0; \
+} \
+if ( n >= AARPTAB_BSIZ ) { \
+	aat = 0; \
+} \
 }
 
 #define AARPT_AGE	(60 * 1)



CVS commit: src/sys/netatalk

2023-07-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jul 31 01:19:50 UTC 2023

Modified Files:
src/sys/netatalk: aarp.c

Log Message:
aarp.c: fix wrong indent and add missing braces inside macro


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/netatalk/aarp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/netatalk

2023-03-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 30 15:58:10 UTC 2023

Modified Files:
src/sys/netatalk: at_control.c

Log Message:
atalk(4): Don't let userland control sa_len when adding addresses.

- The struct sockaddr_at object accessed by at_ifinit always comes
  from an ioctl buffer that is adequately sized and fully initialized
  from userland memory.

- The newly created sockaddr_at object is later used with
  sockaddr_copy, which requires sa_len to be correctly initialized.

- sa_len is not generally required to be correctly initialized by
  userland in most entry points (with some exceptions, e.g. gif(4)
  configuration).

I don't know whether existing userland programs initialize sa_len
correctly; if they do, we can verify it matches sizeof(struct
sockaddr_at), but there's no need to copy sa_len then if it is
verified to be that fixed value.

Reported-by: syzbot+fb4e112846e31bc4c...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=6e511f97443d681b8917c6258d6463b28b36e8c9

Reported-by: syzbot+dce8a2b69dc06d9d6...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=e521a01ced5d0bbd363e998b81bc29f3282fd75f

Reported-by: syzbot+705a2a35990549b12...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=b9147d4070e1d240acd27155ce1f863997175517

Reported-by: syzbot+b9c649832cc9b1fdc...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=d5c9ad3d43042ec6e9f7bd30e13a37205e7e0373

Reported-by: syzbot+ac4ab136ca76e8152...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=349c0c4eded3eff1ff5fc2cd2d88b42806e08a47

Reported-by: syzbot+b75c731d20e46e954...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=e014d790e218797e217dd590ebe5a3a89e65b627

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/netatalk/at_control.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/netatalk

2023-03-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 30 15:58:10 UTC 2023

Modified Files:
src/sys/netatalk: at_control.c

Log Message:
atalk(4): Don't let userland control sa_len when adding addresses.

- The struct sockaddr_at object accessed by at_ifinit always comes
  from an ioctl buffer that is adequately sized and fully initialized
  from userland memory.

- The newly created sockaddr_at object is later used with
  sockaddr_copy, which requires sa_len to be correctly initialized.

- sa_len is not generally required to be correctly initialized by
  userland in most entry points (with some exceptions, e.g. gif(4)
  configuration).

I don't know whether existing userland programs initialize sa_len
correctly; if they do, we can verify it matches sizeof(struct
sockaddr_at), but there's no need to copy sa_len then if it is
verified to be that fixed value.

Reported-by: syzbot+fb4e112846e31bc4c...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=6e511f97443d681b8917c6258d6463b28b36e8c9

Reported-by: syzbot+dce8a2b69dc06d9d6...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=e521a01ced5d0bbd363e998b81bc29f3282fd75f

Reported-by: syzbot+705a2a35990549b12...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=b9147d4070e1d240acd27155ce1f863997175517

Reported-by: syzbot+b9c649832cc9b1fdc...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=d5c9ad3d43042ec6e9f7bd30e13a37205e7e0373

Reported-by: syzbot+ac4ab136ca76e8152...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=349c0c4eded3eff1ff5fc2cd2d88b42806e08a47

Reported-by: syzbot+b75c731d20e46e954...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=e014d790e218797e217dd590ebe5a3a89e65b627

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/netatalk/at_control.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netatalk/at_control.c
diff -u src/sys/netatalk/at_control.c:1.43 src/sys/netatalk/at_control.c:1.44
--- src/sys/netatalk/at_control.c:1.43	Thu Mar 30 11:21:08 2023
+++ src/sys/netatalk/at_control.c	Thu Mar 30 15:58:10 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: at_control.c,v 1.43 2023/03/30 11:21:08 riastradh Exp $	 */
+/*	$NetBSD: at_control.c,v 1.44 2023/03/30 15:58:10 riastradh Exp $	 */
 
 /*
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: at_control.c,v 1.43 2023/03/30 11:21:08 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at_control.c,v 1.44 2023/03/30 15:58:10 riastradh Exp $");
 
 #include "opt_atalk.h"
 
@@ -421,7 +421,7 @@ at_ifinit(struct ifnet *ifp, struct at_i
  * that phase 1 probes use only nodes, not net.node pairs.  Under
  * phase 2, both the net and node must be the same.
  */
-	AA_SAT(aa)->sat_len = sat->sat_len;
+	AA_SAT(aa)->sat_len = sizeof(struct sockaddr_at);
 	AA_SAT(aa)->sat_family = AF_APPLETALK;
 	if (ifp->if_flags & IFF_LOOPBACK) {
 		AA_SAT(aa)->sat_addr.s_net = sat->sat_addr.s_net;



CVS commit: src/sys/netatalk

2023-03-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 30 11:21:08 UTC 2023

Modified Files:
src/sys/netatalk: at_control.c ddp_input.c

Log Message:
atalk(4): Don't abuse queue(9) internals.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/netatalk/at_control.c
cvs rdiff -u -r1.33 -r1.34 src/sys/netatalk/ddp_input.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/netatalk

2023-03-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 30 11:21:08 UTC 2023

Modified Files:
src/sys/netatalk: at_control.c ddp_input.c

Log Message:
atalk(4): Don't abuse queue(9) internals.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/netatalk/at_control.c
cvs rdiff -u -r1.33 -r1.34 src/sys/netatalk/ddp_input.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netatalk/at_control.c
diff -u src/sys/netatalk/at_control.c:1.42 src/sys/netatalk/at_control.c:1.43
--- src/sys/netatalk/at_control.c:1.42	Tue Sep 21 15:01:59 2021
+++ src/sys/netatalk/at_control.c	Thu Mar 30 11:21:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: at_control.c,v 1.42 2021/09/21 15:01:59 christos Exp $	 */
+/*	$NetBSD: at_control.c,v 1.43 2023/03/30 11:21:08 riastradh Exp $	 */
 
 /*
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: at_control.c,v 1.42 2021/09/21 15:01:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at_control.c,v 1.43 2023/03/30 11:21:08 riastradh Exp $");
 
 #include "opt_atalk.h"
 
@@ -88,7 +88,7 @@ at_control(u_long cmd, void *data, struc
  * If we have an ifp, then find the matching at_ifaddr if it exists
  */
 	if (ifp)
-		for (aa = at_ifaddr.tqh_first; aa; aa = aa->aa_list.tqe_next)
+		TAILQ_FOREACH(aa, &at_ifaddr, aa_list)
 			if (aa->aa_ifp == ifp)
 break;
 
@@ -109,7 +109,7 @@ at_control(u_long cmd, void *data, struc
 		 * NEXT interface!
 		 */
 		if (ifra->ifra_addr.sat_family == AF_APPLETALK) {
-			for (; aa; aa = aa->aa_list.tqe_next)
+			for (; aa; aa = TAILQ_NEXT(aa, aa_list))
 if (aa->aa_ifp == ifp &&
 sateqaddr(&aa->aa_addr, &ifra->ifra_addr))
 	break;
@@ -141,7 +141,7 @@ at_control(u_long cmd, void *data, struc
 		 * This may leave aa pointing to the first address on
 			 * the NEXT interface!
 		 */
-			for (; aa; aa = aa->aa_list.tqe_next) {
+			for (; aa; aa = TAILQ_NEXT(aa, aa_list)) {
 if (aa->aa_ifp == ifp &&
 (aa->aa_flags & AFA_PHASE2) == 0)
 	break;
@@ -152,7 +152,7 @@ at_control(u_long cmd, void *data, struc
 		 * This may leave aa pointing to the first address on
 			 * the NEXT interface!
 		 */
-			for (; aa; aa = aa->aa_list.tqe_next) {
+			for (; aa; aa = TAILQ_NEXT(aa, aa_list)) {
 if (aa->aa_ifp == ifp &&
 (aa->aa_flags & AFA_PHASE2))
 	break;
@@ -177,7 +177,7 @@ at_control(u_long cmd, void *data, struc
 
 			callout_init(&aa->aa_probe_ch, 0);
 
-			if ((aa0 = at_ifaddr.tqh_first) != NULL) {
+			if ((aa0 = TAILQ_FIRST(&at_ifaddr)) != NULL) {
 /*
  * Don't let the loopback be first, since the
  * first address is the machine's default
@@ -245,7 +245,7 @@ at_control(u_long cmd, void *data, struc
 		 * If the request is specifying phase 1, then
 		 * only look at a phase one address
 		 */
-			for (; aa; aa = aa->aa_list.tqe_next) {
+			for (; aa; aa = TAILQ_NEXT(aa, aa_list)) {
 if (aa->aa_ifp == ifp &&
 (aa->aa_flags & AFA_PHASE2) == 0)
 	break;
@@ -255,7 +255,7 @@ at_control(u_long cmd, void *data, struc
 		 * If the request is specifying phase 2, then
 		 * only look at a phase two address
 		 */
-			for (; aa; aa = aa->aa_list.tqe_next) {
+			for (; aa; aa = TAILQ_NEXT(aa, aa_list)) {
 if (aa->aa_ifp == ifp &&
 (aa->aa_flags & AFA_PHASE2))
 	break;
@@ -264,7 +264,7 @@ at_control(u_long cmd, void *data, struc
 			/*
 		 * default to everything
 		 */
-			for (; aa; aa = aa->aa_list.tqe_next) {
+			for (; aa; aa = TAILQ_NEXT(aa, aa_list)) {
 if (aa->aa_ifp == ifp)
 	break;
 			}
@@ -682,7 +682,7 @@ at_broadcast(const struct sockaddr_at *s
 	/*
  * failing that, if the net is one we have, it's a broadcast as well.
  */
-	for (aa = at_ifaddr.tqh_first; aa; aa = aa->aa_list.tqe_next) {
+	TAILQ_FOREACH(aa, &at_ifaddr, aa_list) {
 		if ((aa->aa_ifp->if_flags & IFF_BROADCAST)
 		&& (ntohs(sat->sat_addr.s_net) >= ntohs(aa->aa_firstnet)
 		  && ntohs(sat->sat_addr.s_net) <= ntohs(aa->aa_lastnet)))

Index: src/sys/netatalk/ddp_input.c
diff -u src/sys/netatalk/ddp_input.c:1.33 src/sys/netatalk/ddp_input.c:1.34
--- src/sys/netatalk/ddp_input.c:1.33	Sat Sep  3 02:48:00 2022
+++ src/sys/netatalk/ddp_input.c	Thu Mar 30 11:21:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ddp_input.c,v 1.33 2022/09/03 02:48:00 thorpej Exp $	 */
+/*	$NetBSD: ddp_input.c,v 1.34 2023/03/30 11:21:08 riastradh Exp $	 */
 
 /*
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ddp_input.c,v 1.33 2022/09/03 02:48:00 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ddp_input.c,v 1.34 2023/03/30 11:21:08 riastradh Exp $");
 #include "opt_atalk.h"
 
 #include 
@@ -163,7 +163,7 @@ ddp_input(struct mbuf *m, struct

CVS commit: src/sys/netatalk

2021-09-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Sep 21 15:01:59 UTC 2021

Modified Files:
src/sys/netatalk: at_control.c ddp_usrreq.c

Log Message:
don't opencode kauth_cred_get()


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/netatalk/at_control.c
cvs rdiff -u -r1.74 -r1.75 src/sys/netatalk/ddp_usrreq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netatalk/at_control.c
diff -u src/sys/netatalk/at_control.c:1.41 src/sys/netatalk/at_control.c:1.42
--- src/sys/netatalk/at_control.c:1.41	Mon Aug  2 08:56:25 2021
+++ src/sys/netatalk/at_control.c	Tue Sep 21 11:01:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: at_control.c,v 1.41 2021/08/02 12:56:25 andvar Exp $	 */
+/*	$NetBSD: at_control.c,v 1.42 2021/09/21 15:01:59 christos Exp $	 */
 
 /*
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: at_control.c,v 1.41 2021/08/02 12:56:25 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at_control.c,v 1.42 2021/09/21 15:01:59 christos Exp $");
 
 #include "opt_atalk.h"
 
@@ -127,7 +127,7 @@ at_control(u_long cmd, void *data, struc
 		 * If we are not superuser, then we don't get to do these
 		 * ops.
 		 */
-		if (kauth_authorize_network(curlwp->l_cred,
+		if (kauth_authorize_network(kauth_cred_get(),
 		KAUTH_NETWORK_INTERFACE,
 		KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, (void *)cmd,
 		NULL) != 0)

Index: src/sys/netatalk/ddp_usrreq.c
diff -u src/sys/netatalk/ddp_usrreq.c:1.74 src/sys/netatalk/ddp_usrreq.c:1.75
--- src/sys/netatalk/ddp_usrreq.c:1.74	Fri Nov 29 12:40:16 2019
+++ src/sys/netatalk/ddp_usrreq.c	Tue Sep 21 11:01:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ddp_usrreq.c,v 1.74 2019/11/29 17:40:16 maxv Exp $	 */
+/*	$NetBSD: ddp_usrreq.c,v 1.75 2021/09/21 15:01:59 christos Exp $	 */
 
 /*
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.74 2019/11/29 17:40:16 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.75 2021/09/21 15:01:59 christos Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_atalk.h"
@@ -120,7 +120,8 @@ at_pcbsetaddr(struct ddpcb *ddp, struct 
 return (EINVAL);
 
 			if (sat->sat_port < ATPORT_RESERVED &&
-			(error = kauth_authorize_network(curlwp->l_cred,
+			(error = kauth_authorize_network(
+			kauth_cred_get(),
 			KAUTH_NETWORK_BIND, KAUTH_REQ_NETWORK_BIND_PRIVPORT,
 			ddpcb->ddp_socket, sat, NULL)) != 0)
 return (error);



CVS commit: src/sys/netatalk

2021-09-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Sep 21 15:01:59 UTC 2021

Modified Files:
src/sys/netatalk: at_control.c ddp_usrreq.c

Log Message:
don't opencode kauth_cred_get()


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/netatalk/at_control.c
cvs rdiff -u -r1.74 -r1.75 src/sys/netatalk/ddp_usrreq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/netatalk

2019-11-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 29 17:40:16 UTC 2019

Modified Files:
src/sys/netatalk: ddp_usrreq.c

Log Message:
Add sanity check, only sat_len bytes got copied in, the rest is
uninitialized. Found by KMSAN.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/netatalk/ddp_usrreq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/netatalk

2019-11-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 29 17:40:16 UTC 2019

Modified Files:
src/sys/netatalk: ddp_usrreq.c

Log Message:
Add sanity check, only sat_len bytes got copied in, the rest is
uninitialized. Found by KMSAN.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/netatalk/ddp_usrreq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netatalk/ddp_usrreq.c
diff -u src/sys/netatalk/ddp_usrreq.c:1.73 src/sys/netatalk/ddp_usrreq.c:1.74
--- src/sys/netatalk/ddp_usrreq.c:1.73	Sun Feb 24 07:20:33 2019
+++ src/sys/netatalk/ddp_usrreq.c	Fri Nov 29 17:40:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ddp_usrreq.c,v 1.73 2019/02/24 07:20:33 maxv Exp $	 */
+/*	$NetBSD: ddp_usrreq.c,v 1.74 2019/11/29 17:40:16 maxv Exp $	 */
 
 /*
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.73 2019/02/24 07:20:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.74 2019/11/29 17:40:16 maxv Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_atalk.h"
@@ -97,6 +97,8 @@ at_pcbsetaddr(struct ddpcb *ddp, struct 
 
 		if (sat->sat_family != AF_APPLETALK)
 			return (EAFNOSUPPORT);
+		if (sat->sat_len != sizeof(*sat))
+			return EINVAL;
 
 		if (sat->sat_addr.s_node != ATADDR_ANYNODE ||
 		sat->sat_addr.s_net != ATADDR_ANYNET) {



CVS commit: src/sys/netatalk

2019-10-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Oct  9 14:15:40 UTC 2019

Modified Files:
src/sys/netatalk: at_var.h

Log Message:
Memset to prevent stack info leak.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/netatalk/at_var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/netatalk

2019-10-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Oct  9 14:15:40 UTC 2019

Modified Files:
src/sys/netatalk: at_var.h

Log Message:
Memset to prevent stack info leak.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/netatalk/at_var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netatalk/at_var.h
diff -u src/sys/netatalk/at_var.h:1.8 src/sys/netatalk/at_var.h:1.9
--- src/sys/netatalk/at_var.h:1.8	Thu Apr 19 21:50:10 2018
+++ src/sys/netatalk/at_var.h	Wed Oct  9 14:15:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: at_var.h,v 1.8 2018/04/19 21:50:10 christos Exp $	 */
+/*	$NetBSD: at_var.h,v 1.9 2019/10/09 14:15:40 maxv Exp $	 */
 
 /*
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -75,13 +75,13 @@ sockaddr_at_init1(struct sockaddr_at *sa
 {
 	sat->sat_port = port;
 	sat->sat_addr = *addr;
-	memset(&sat->sat_range, 0, sizeof(sat->sat_range));
 }
 
 static __inline void
 sockaddr_at_init(struct sockaddr_at *sat, const struct at_addr *addr,
 uint8_t port)
 {
+	memset(sat, 0, sizeof(*sat));
 	sat->sat_family = AF_APPLETALK;
 	sat->sat_len = sizeof(*sat);
 	sockaddr_at_init1(sat, addr, port);
@@ -92,7 +92,8 @@ sockaddr_at_alloc(const struct at_addr *
 {
 	struct sockaddr *sa;
 
-	sa = sockaddr_alloc(AF_APPLETALK, sizeof(struct sockaddr_at), flags);
+	sa = sockaddr_alloc(AF_APPLETALK, sizeof(struct sockaddr_at),
+	flags | M_ZERO);
 
 	if (sa == NULL)
 		return NULL;



CVS commit: src/sys/netatalk

2010-01-30 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Sat Jan 30 21:48:30 UTC 2010

Modified Files:
src/sys/netatalk: at_control.c

Log Message:
Use the symbolic names. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/netatalk/at_control.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.