Re: pr_input with af

2017-04-13 Thread Mike Belopuhov
On 13 April 2017 at 00:53, Alexander Bluhm  wrote:
> Hi,
>
> I would like to pass down the address family through the pr_input
> calls.  There are functions like tcp_input() and udp_input() which
> read the version from the IP header.  This layer violation could
> be avoided if they know the af.  Functions like carp_proto_input
> and carp6_proto_input could be unified.
>
> This is only the machanical part that adds an af parameter.
>
> ok?
>
> bluhm
>

No objections here, I think this is a good idea.



pr_input with af

2017-04-12 Thread Alexander Bluhm
Hi,

I would like to pass down the address family through the pr_input
calls.  There are functions like tcp_input() and udp_input() which
read the version from the IP header.  This layer violation could
be avoided if they know the af.  Functions like carp_proto_input
and carp6_proto_input could be unified.

This is only the machanical part that adds an af parameter.

ok?

bluhm

Index: net/if_etherip.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_etherip.c,v
retrieving revision 1.16
diff -u -p -r1.16 if_etherip.c
--- net/if_etherip.c27 Mar 2017 23:49:03 -  1.16
+++ net/if_etherip.c12 Apr 2017 21:53:16 -
@@ -405,7 +405,7 @@ ip_etherip_output(struct ifnet *ifp, str
 }
 
 int
-ip_etherip_input(struct mbuf **mp, int *offp, int proto)
+ip_etherip_input(struct mbuf **mp, int *offp, int proto, int af)
 {
struct mbuf *m = *mp;
struct mbuf_list ml = MBUF_LIST_INITIALIZER();
@@ -453,7 +453,7 @@ ip_etherip_input(struct mbuf **mp, int *
 * This is tricky but the path will be removed soon when
 * implementation of etherip is removed from gif(4).
 */
-   return etherip_input(mp, offp, proto);
+   return etherip_input(mp, offp, proto, af);
 #else
etheripstat.etherips_noifdrops++;
m_freem(m);
@@ -567,7 +567,7 @@ drop:
 }
 
 int
-ip6_etherip_input(struct mbuf **mp, int *offp, int proto)
+ip6_etherip_input(struct mbuf **mp, int *offp, int proto, int af)
 {
struct mbuf *m = *mp;
struct mbuf_list ml = MBUF_LIST_INITIALIZER();
@@ -613,7 +613,7 @@ ip6_etherip_input(struct mbuf **mp, int 
 * This is tricky but the path will be removed soon when
 * implementation of etherip is removed from gif(4).
 */
-   return etherip_input(mp, offp, proto);
+   return etherip_input(mp, offp, proto, af);
 #else
etheripstat.etherips_noifdrops++;
m_freem(m);
Index: net/if_etherip.h
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_etherip.h,v
retrieving revision 1.5
diff -u -p -r1.5 if_etherip.h
--- net/if_etherip.h8 Mar 2017 06:50:38 -   1.5
+++ net/if_etherip.h12 Apr 2017 21:53:27 -
@@ -73,11 +73,11 @@ struct etherip_header {
 
 int ip_etherip_sysctl(int *, uint, void *, size_t *, void *, size_t);
 int ip_etherip_output(struct ifnet *, struct mbuf *);
-int ip_etherip_input(struct mbuf **, int *, int);
+int ip_etherip_input(struct mbuf **, int *, int, int);
 
 #ifdef INET6
 int ip6_etherip_output(struct ifnet *, struct mbuf *);
-int ip6_etherip_input(struct mbuf **, int *, int);
+int ip6_etherip_input(struct mbuf **, int *, int, int);
 #endif /* INET6 */
 
 
Index: net/if_gif.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_gif.c,v
retrieving revision 1.91
diff -u -p -r1.91 if_gif.c
--- net/if_gif.c29 Jan 2017 19:58:47 -  1.91
+++ net/if_gif.c12 Apr 2017 22:01:27 -
@@ -716,7 +716,7 @@ in_gif_output(struct ifnet *ifp, int fam
 }
 
 int
-in_gif_input(struct mbuf **mp, int *offp, int proto)
+in_gif_input(struct mbuf **mp, int *offp, int proto, int af)
 {
struct mbuf *m = *mp;
struct gif_softc *sc;
@@ -762,7 +762,7 @@ in_gif_input(struct mbuf **mp, int *offp
 
 inject:
/* No GIF interface was configured */
-   return ip4_input(mp, offp, proto);
+   return ip4_input(mp, offp, proto, af);
 }
 
 #ifdef INET6
@@ -839,7 +839,7 @@ in6_gif_output(struct ifnet *ifp, int fa
return 0;
 }
 
-int in6_gif_input(struct mbuf **mp, int *offp, int proto)
+int in6_gif_input(struct mbuf **mp, int *offp, int proto, int af)
 {
struct mbuf *m = *mp;
struct gif_softc *sc;
@@ -888,6 +888,6 @@ int in6_gif_input(struct mbuf **mp, int 
 
 inject:
/* No GIF tunnel configured */
-   return ip4_input(mp, offp, proto);
+   return ip4_input(mp, offp, proto, af);
 }
 #endif /* INET6 */
Index: net/if_gif.h
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_gif.h,v
retrieving revision 1.16
diff -u -p -r1.16 if_gif.h
--- net/if_gif.h29 Jan 2017 19:58:47 -  1.16
+++ net/if_gif.h12 Apr 2017 22:00:46 -
@@ -49,7 +49,7 @@ extern LIST_HEAD(gif_softc_head, gif_sof
 
 int gif_encap(struct ifnet *, struct mbuf **, sa_family_t);
 
-int in_gif_input(struct mbuf **, int *, int);
-int in6_gif_input(struct mbuf **, int *, int);
+int in_gif_input(struct mbuf **, int *, int, int);
+int in6_gif_input(struct mbuf **, int *, int, int);
 
 #endif /* _NET_IF_GIF_H_ */
Index: net/if_pfsync.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_pfsync.c,v
retrieving rev