mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-20 11:11:24 +00:00
Rework r191742.
Use the protocol family constants for the domain argument validation. Return EAFNOSUPPORT in case when the incorrect domain argument is specified. Return EPROTONOSUPPORT instead of passing values that are not 0 to the BSD layer. Suggested by: rwatson Approved by: kib (mentor) MFC after: 1 month
This commit is contained in:
parent
426909d969
commit
1a52a4abf7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=191871
@ -855,14 +855,21 @@ linux_socketpair(struct thread *td, struct linux_socketpair_args *args)
|
||||
} */ bsd_args;
|
||||
|
||||
bsd_args.domain = linux_to_bsd_domain(args->domain);
|
||||
if (bsd_args.domain == -1)
|
||||
return (EINVAL);
|
||||
if (bsd_args.domain != PF_LOCAL)
|
||||
return (EAFNOSUPPORT);
|
||||
|
||||
bsd_args.type = args->type;
|
||||
if (bsd_args.domain == AF_LOCAL && args->protocol == PF_UNIX)
|
||||
bsd_args.protocol = 0;
|
||||
if (args->protocol != 0 && args->protocol != PF_UNIX)
|
||||
|
||||
/*
|
||||
* Use of PF_UNIX as protocol argument is not right,
|
||||
* but Linux does it.
|
||||
* Do not map PF_UNIX as its Linux value is identical
|
||||
* to FreeBSD one.
|
||||
*/
|
||||
return (EPROTONOSUPPORT);
|
||||
else
|
||||
bsd_args.protocol = args->protocol;
|
||||
bsd_args.protocol = 0;
|
||||
bsd_args.rsv = (int *)PTRIN(args->rsv);
|
||||
return (socketpair(td, &bsd_args));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user