Thomas Huth, on Mon 14 Dec 2015 21:17:19 +0100, wrote: > > + lhost.ss_family = AF_INET; > > + ((struct sockaddr_in *)&lhost)->sin_addr = ti->ti_src; > > + ((struct sockaddr_in *)&lhost)->sin_port = ti->ti_sport; > > + fhost.ss_family = AF_INET; > > + ((struct sockaddr_in *)&fhost)->sin_addr = ti->ti_dst; > > + ((struct sockaddr_in *)&fhost)->sin_port = ti->ti_dport; > > Couldn't you simply use "fhost.sin.sin_addr = ..." etc. instead of > casting everything via a pointer?
No, here fhost is a struct sockaddr_storage, which doesn't have a sin field. We could define a struct sockaddr_in *fhost4 that would be made an alias to fhost, but I don't feel it's more readable to introduce an alias than expliciting those two casts. Samuel