[PATCH 3/7] comm, site: pass a new "struct comm_addr" rather than sockaddr_in
Richard Kettlewell
rjk at terraraq.org.uk
Fri Jul 22 21:22:10 BST 2011
> static bool_t udp_sendmsg(void *commst, struct buffer_if *buf,
> - struct sockaddr_in *dest)
> + const struct comm_addr *dest)
> {
> struct udp *st=commst;
> uint8_t *sa;
>
> if (st->use_proxy) {
> sa=buf->start-8;
> - memcpy(sa,&dest->sin_addr,4);
> + memcpy(sa,&dest->sin.sin_addr,4);
> memset(sa+4,0,4);
> - memcpy(sa+6,&dest->sin_port,2);
> + memcpy(sa+6,&dest->sin.sin_port,2);
> sendto(st->fd,sa,buf->size+8,0,(struct sockaddr *)&st->proxy,
> sizeof(st->proxy));
This is a tangential point to the patch, which seems fine to me, but I
wonder if we can do better than the magic number offsets in there?
udp_afterpoll() too.
ttfn/rjk
More information about the sgo-software-discuss
mailing list