Source-Changes-HG archive

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

[src/trunk]: src/sys/net Increase sdl_data so that more then IFNAMSIZ bytes a...



details:   https://anonhg.NetBSD.org/src/rev/48d1c6ddf69e
branches:  trunk
changeset: 372275:48d1c6ddf69e
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Nov 07 08:32:35 2022 +0000

description:
Increase sdl_data so that more then IFNAMSIZ bytes are available (again).

COMPAT_9 is not required.

 - The getifaddrs(3) function has no problem. The routing message has no
   problem because struct rtm_msglen has rtm_msglen and we can get the next
   message using with it. There is no any kernel data structure which has
   struct sockaddr_dl foobadr[xxx] array.

 - A data passed from userland and a kernel data are compared with
   sockaddr_cmp(). The return value is used to check if the size is
   inadequate or not.

 - In the kernel, sdl_len is not directly used for the length of memcpy()
   but the sockaddr_dl_measure() is used for it.

diffstat:

 sys/net/if_dl.h |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (26 lines):

diff -r e7a16b38d950 -r 48d1c6ddf69e sys/net/if_dl.h
--- a/sys/net/if_dl.h   Mon Nov 07 07:28:04 2022 +0000
+++ b/sys/net/if_dl.h   Mon Nov 07 08:32:35 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_dl.h,v 1.30 2022/10/27 00:25:11 msaitoh Exp $       */
+/*     $NetBSD: if_dl.h,v 1.31 2022/11/07 08:32:35 msaitoh Exp $       */
 
 /*
  * Copyright (c) 1990, 1993
@@ -68,11 +68,11 @@
        uint8_t     dl_nlen;    /* interface name length, no trailing 0 reqd. */
        uint8_t     dl_alen;    /* link level address length */
        uint8_t     dl_slen;    /* link layer selector length */
-       /*
-        * minimum work area, can be larger; contains both if name
-        * and ll address
-        */
-       char        dl_data[12];
+       char        dl_data[24]; /*
+                                 * minimum work area, can be larger; contains
+                                 * both if name and ll address; big enough for
+                                 * IFNAMSIZ plus 8byte ll addr.
+                                 */
 };
 
 /*



Home | Main Index | Thread Index | Old Index