mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
Convert proto family in both directions. The linux and native values for
local and inet are identical, but for inet6 values differ. PR: 155040 Reported by: Simon Walton MFC after: 2 week
This commit is contained in:
parent
e5e35a7715
commit
df964aa45d
1 changed files with 12 additions and 4 deletions
|
|
@ -462,12 +462,16 @@ bsd_to_linux_sockaddr(struct sockaddr *arg)
|
|||
{
|
||||
struct sockaddr sa;
|
||||
size_t sa_len = sizeof(struct sockaddr);
|
||||
int error;
|
||||
int error, bdom;
|
||||
|
||||
if ((error = copyin(arg, &sa, sa_len)))
|
||||
return (error);
|
||||
|
||||
*(u_short *)&sa = sa.sa_family;
|
||||
bdom = bsd_to_linux_domain(sa.sa_family);
|
||||
if (bdom == -1)
|
||||
return (EAFNOSUPPORT);
|
||||
|
||||
*(u_short *)&sa = bdom;
|
||||
return (copyout(&sa, arg, sa_len));
|
||||
}
|
||||
|
||||
|
|
@ -476,12 +480,16 @@ linux_to_bsd_sockaddr(struct sockaddr *arg, int len)
|
|||
{
|
||||
struct sockaddr sa;
|
||||
size_t sa_len = sizeof(struct sockaddr);
|
||||
int error;
|
||||
int error, bdom;
|
||||
|
||||
if ((error = copyin(arg, &sa, sa_len)))
|
||||
return (error);
|
||||
|
||||
sa.sa_family = *(sa_family_t *)&sa;
|
||||
bdom = linux_to_bsd_domain(*(sa_family_t *)&sa);
|
||||
if (bdom == -1)
|
||||
return (EAFNOSUPPORT);
|
||||
|
||||
sa.sa_family = bdom;
|
||||
sa.sa_len = len;
|
||||
return (copyout(&sa, arg, sa_len));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue