Radclient : received bad packet

Orestes Leal Rodríguez olealrd1981 at gmail.com
Sun Oct 6 18:54:24 CEST 2019


Arvind,

You have this code:

           reply = fr_packet_list_recv(pl, &rdset);
           if (!reply) {
                printf( "radclient: received bad packet: %s\n",strerror(errno));
                return -1;  /* bad packet */
            }
			
Two things about it:

On the freeradius library: packet.c:908 (fr_packet_list_recv) there
are two possible
reasons that the function will return NULL (your case).

  1. pl OR rdset == NULL    (packet.c: if (!pl || !set) return NULL;)

  2. This doesn't hold (from packet.c):

		 start = pl->last_recv;
         do
		 ...
		 } while (start != pl->last_recv);

I would say that you have an issue with pl or rdset or pl->last_recv
is different than what freeradius expect.


NOTES:

I would actually suggest replacing:

> if ((bind(fd, (struct sockaddr *)&serveraddr, addrsize))<0)

by this:

> if ((bind(fd, (struct sockaddr *)&serveraddr, addrsize)) == -1)

>From bind(2) (POSIX.1)

RETURN VALUE
       On success, zero is returned.  On error, -1 is returned, and
errno is set appropriately.


Orestes


More information about the Freeradius-Users mailing list