[hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl
- From: David Martin <david.martin.mailbox@xxxxxxxxxxxxxx>
- To: hipl-dev@xxxxxxxxxxxxx
- Date: Mon, 27 Feb 2012 10:02:10 +0100
Hi,
On Mon, Feb 27, 2012 at 9:04 AM, Stefan Götz <stefan.goetz@xxxxxx> wrote:
>> + is_ipv4 = (src_addr.sa_family == AF_INET);
>> + if (is_ipv4) {
>> + saddr4 = (struct sockaddr_in *) &src_addr;
>> + IPV4_TO_IPV6_MAP(&saddr4->sin_addr, &ctx->src_addr);
>> + ctx->msg_ports.src_port = ntohs(saddr4->sin_port);
>> + } else {
>> + saddr6 = (struct sockaddr_in6 *) &src_addr;
>> + memcpy(&ctx->dst_addr, &saddr6->sin6_addr, sizeof(struct in6_addr));
>
> a plain assignment instead of memcpy is easier to read in such cases, but
> that is a matter of taste.
Either way there's a wrapper function for this purpose in
lib/core/prefix.c: ipv6_addr_copy(). Not sure if assignments are a
good idea but the wrapper should definitely be used instead of the
manual memcpy() with sizeof(). :)
- References:
Other related posts:
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Christof Mroz
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Christof Mroz
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Christof Mroz
- » [hipl-dev] [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin
- » [hipl-dev] [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Christof Mroz
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Christof Mroz
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Christof Mroz
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Stefan Götz
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Christof Mroz
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Stefan Götz
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Stefan Götz
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - David Martin
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - David Martin
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Stefan Götz
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Stefan Götz
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Stefan Götz
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin
- » [hipl-dev] [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Christof Mroz
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - René Hummen
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin
- » [hipl-dev] [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Christof Mroz
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Christof Mroz
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin Gu
- » [hipl-dev] [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin
- » [hipl-dev] [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Xin
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Miika Komu
- » [hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - Diego Biurrun
- » [hipl-dev] [Merge] lp:~hipl-core/hipl/libhip into lp:hipl - noreply