On Wed, Feb 12, 2014 at 09:11:41PM +0100, Alexander Bluhm wrote:
> On Wed, Feb 12, 2014 at 10:10:36AM -0800, Loganaden Velvindron wrote:
> > Hi All,
> >
> > based on a similar change from FreeBSD:
> >
> > Change the return error from EACCES to EPERM as it is not a file.
>
> According to errno(2) EACCES is for file access permissions, so
> EPERM seems more apporiate.
>
> A grep for EACCES and EPERM in netinet and netinet6 shows that both
> are used often. Do we want to move towards EPERM for networking?
>
> I think ip6_mrouter_set() and ip6_mrouter_get() should stay in sync,
> so please make the diff for both functions.
>
> bluhm
Please find attached the diff (tested on my OpenBSD laptop running -current
and a tunnel to HE):
Index: sys/netinet6/ip6_mroute.c
===================================================================
RCS file: /cvs/src/sys/netinet6/ip6_mroute.c,v
retrieving revision 1.67
diff -u -p -u -p -r1.67 ip6_mroute.c
--- sys/netinet6/ip6_mroute.c 11 Nov 2013 09:15:35 -0000 1.67
+++ sys/netinet6/ip6_mroute.c 2 Mar 2014 13:41:18 -0000
@@ -247,7 +247,7 @@ int
ip6_mrouter_set(int cmd, struct socket *so, struct mbuf *m)
{
if (cmd != MRT6_INIT && so != ip6_mrouter)
- return (EACCES);
+ return (EPERM);
switch (cmd) {
case MRT6_INIT:
@@ -287,7 +287,8 @@ ip6_mrouter_set(int cmd, struct socket *
int
ip6_mrouter_get(int cmd, struct socket *so, struct mbuf **m)
{
- if (so != ip6_mrouter) return EACCES;
+ if (so != ip6_mrouter)
+ return (EPERM);
*m = m_get(M_WAIT, MT_SOOPTS);
>
> >
> > Index: src/sys/netinet6/ip6_mroute.c
> > ===================================================================
> > RCS file: /cvs/src/sys/netinet6/ip6_mroute.c,v
> > retrieving revision 1.67
> > diff -u -p -u -p -r1.67 ip6_mroute.c
> > --- src/sys/netinet6/ip6_mroute.c 11 Nov 2013 09:15:35 -0000 1.67
> > +++ src/sys/netinet6/ip6_mroute.c 12 Feb 2014 18:04:44 -0000
> > @@ -247,7 +247,7 @@ int
> > ip6_mrouter_set(int cmd, struct socket *so, struct mbuf *m)
> > {
> > if (cmd != MRT6_INIT && so != ip6_mrouter)
> > - return (EACCES);
> > + return (EPERM);
> >
> > switch (cmd) {
> > case MRT6_INIT: