The following patch replaces the hard-coded message size of 2048 bytes
in ifstated.c:rt_msg_handler() with RTM_MAXSIZE (which is currently
defined as 2048 bytes) that, I believe, was the intent of the author.
> On Sun, Jul 14, 2019 at 05:28:17PM +0300, Vadim Penzin wrote:
>> The following patch replaces the hard-coded message size of 2048 bytes in
>> ifstated.c:rt_msg_handler() with RTM_MAXSIZE (which is currently defined as
>> 2048 bytes) that, I believe, was the intent of the author.
>> Index: ifstated.c
>> RCS file: /cvs/src/usr.sbin/ifstated/ifstated.c,v
>> retrieving revision 1.64
>> diff -u -p -r1.64 ifstated.c
>> --- ifstated.c 28 Jun 2019 13:32:47 -0000 1.64
>> +++ ifstated.c 14 Jul 2019 14:22:32 -0000
>> @@ -236,7 +236,7 @@ load_config(void)
>> rt_msg_handler(int fd, short event, void *arg)
>> - char msg;
>> + char msg[RTM_MAXSIZE];
>> struct rt_msghdr *rtm = (struct rt_msghdr *)&msg;
>> struct if_msghdr ifm;
>> struct if_announcemsghdr ifan;
> I don't think RTM_MAXSIZE should be used outside of the kernel.
> Especially for reading messages. I would leave the code as is.
In that case, please hide RTM_MAXSIZE using _KERNEL. The definition of
RTM_MAXSIZE is right above RTM_ADD which is user-visible according to
the current documentation.
What about other defines? Can user-space programs use RTM_VERSION, for