Hello,

Thanks for working on it :)

Thomas Huth, on Tue 16 Feb 2016 09:47:38 +0100, wrote:
> -static int tftp_session_allocate(Slirp *slirp, struct tftp_t *tp)
> +static int tftp_session_allocate(struct sockaddr_storage *srcsas, Slirp 
> *slirp,
> +                                 struct tftp_t *tp)

slirp is usually the first parameter, it'd probably be better to keep
this habit.

> -static int tftp_session_find(Slirp *slirp, struct tftp_t *tp)
> +static int tftp_session_find(struct sockaddr_storage *srcsas, Slirp *slirp,
> +                             struct tftp_t *tp)

ditto.

> +static void tftp_udp_output(struct tftp_session *spt, struct mbuf *m,
> +                            struct tftp_t *recv_tp)
> +{
> +    if (spt->client_addr.ss_family == AF_INET6) {
> +        struct sockaddr_in6 sa6, da6;
> +
> +        memcpy(&sa6.sin6_addr, spt->slirp->vhost_addr6.s6_addr, 16);

Why not simply sa6.sin6_addr = spt->slirp->vhost_addr6?

The compiler will optimize the structure assignment as an inline copy or
memcpy call as appropriate.

> +        sa6.sin6_port = recv_tp->udp.uh_dport;
> +        memcpy(&da6.sin6_addr,
> +               &((struct sockaddr_in6 *)&spt->client_addr)->sin6_addr, 16);

ditto.

Otherwise the patch looks particularly good :)

Samuel

Reply via email to