onsdag den 8 september 2010 klockan 06:09 skrev Guillem Jover detta: > Hi! > > > söndag den 5 september 2010 klockan 23:05 skrev Guillem Jover detta: > > > On Thu, 2010-08-19 at 10:39:04 +0200, Mats Erik Andersson wrote: > > > > +get_socklen (struct sockaddr *sa) > > > > > > This one is also unneeded, you should just use sockaddr_storage for > > > storage as it's guaranteed to be able to store any socket address, > > > then sizeof of the sockaddr_storage type or variable should just > > > work fine. > > > This function is absolutely necessary to get support for OpenBSD. > > I had to redo the whole patch set once I did observe this fact. > > The frasing "should work fine" is utterly inapplicable here. > > Oh right, all BSD expect the socklen_t argument to match exactly with > the sockaddr length of the specific protocol. > > Anyway, the function is still not needed, you always know the size of > the sockaddr. Either from getaddrinfo's ai_addrlen in struct addrinfo > or from recvfrom's addrlen argument, for example.
Indeed correct, a new signature for "verifyhost(sockaddr_storage, socklen_t)" in "src/tftpd.c" allows for removal of get_socklen() there, and the addition of a new static variable "peeraddrlen" in "src/tftp.c" takes care of the rest. A most satisfactory solution. My honest thank to Guillem J. for pushing/leading me in this direction. I will try to eliminate get_port() and set_port() also. You all should now conclude that my previous patch set is not ripe for inclusion. Improvement will follow! In addition, I hope to see my recent scope transition patch, i.e., from "extern" to "static" in "src/tftp.c", make its way into the repository first. That change whould better separate the changes I will make for address independence. Regards for now, Mats E A