On Tue, Aug 7, 2018 at 5:49 AM, Charles Myers <[email protected]> wrote:
> Signed-off-by: Charles Myers <[email protected]> > --- > Makefile | 27 ++++++++++++++++++- > bsd/net.cc | 23 +++++++++++++++- > bsd/porting/netport.h | 4 +++ > bsd/sys/dev/xen/netfront/netfront.cc | 4 +++ > conf/base.mk | 5 ++++ > include/api/netinet/in.h | 52 +++--------------------------- > ------ > 6 files changed, 64 insertions(+), 51 deletions(-) > > diff --git a/Makefile b/Makefile > index d5b6fda..317e727 100644 > --- a/Makefile > +++ b/Makefile > @@ -347,7 +347,7 @@ $(out)/bsd/%.o: INCLUDES += -isystem bsd/ > # for machine/ > $(out)/bsd/%.o: INCLUDES += -isystem bsd/$(arch) > > -configuration-defines = conf-preempt conf-debug_memory conf-logger_debug > +configuration-defines = conf-preempt conf-debug_memory conf-logger_debug > conf-INET6 > > configuration = $(foreach cf,$(configuration-defines), \ > -D$(cf:conf-%=CONF_%)=$($(cf))) > @@ -611,6 +611,31 @@ bsd += bsd/sys/netinet/cc/cc_cubic.o > bsd += bsd/sys/netinet/cc/cc_htcp.o > bsd += bsd/sys/netinet/cc/cc_newreno.o > bsd += bsd/sys/netinet/arpcache.o > +ifeq ($(conf-INET6), 1) > +bsd += bsd/sys/netinet6/dest6.o > +bsd += bsd/sys/netinet6/frag6.o > +bsd += bsd/sys/netinet6/icmp6.o > +bsd += bsd/sys/netinet6/in6.o > +bsd += bsd/sys/netinet6/in6_cksum.o > +bsd += bsd/sys/netinet6/in6_ifattach.o > +bsd += bsd/sys/netinet6/in6_mcast.o > +bsd += bsd/sys/netinet6/in6_pcb.o > +bsd += bsd/sys/netinet6/in6_proto.o > +bsd += bsd/sys/netinet6/in6_rmx.o > +bsd += bsd/sys/netinet6/in6_src.o > +bsd += bsd/sys/netinet6/ip6_forward.o > +bsd += bsd/sys/netinet6/ip6_id.o > +bsd += bsd/sys/netinet6/ip6_input.o > +bsd += bsd/sys/netinet6/ip6_output.o > +bsd += bsd/sys/netinet6/mld6.o > +bsd += bsd/sys/netinet6/nd6.o > +bsd += bsd/sys/netinet6/nd6_nbr.o > +bsd += bsd/sys/netinet6/nd6_rtr.o > +bsd += bsd/sys/netinet6/raw_ip6.o > +bsd += bsd/sys/netinet6/route6.o > +bsd += bsd/sys/netinet6/scope6.o > +bsd += bsd/sys/netinet6/udp6_usrreq.o > +endif > bsd += bsd/sys/xdr/xdr.o > bsd += bsd/sys/xdr/xdr_array.o > bsd += bsd/sys/xdr/xdr_mem.o > diff --git a/bsd/net.cc b/bsd/net.cc > index f548e09..3fe334a 100644 > --- a/bsd/net.cc > +++ b/bsd/net.cc > @@ -24,6 +24,11 @@ > #include <bsd/sys/net/ethernet.h> > #include <bsd/sys/net/route.h> > #include <bsd/sys/compat/linux/linux_netlink.h> > +#ifdef INET6 > +#include <bsd/sys/netinet/icmp6.h> > +#include <bsd/sys/netinet6/in6.h> > +#include <bsd/sys/netinet6/mld6.h> > +#endif > > /* Generation of ip ids */ > void ip_initid(void); > @@ -31,6 +36,10 @@ void ip_initid(void); > extern "C" { > /* AF_INET */ > extern struct domain inetdomain; > +#ifdef INET6 > + /* AF_INET6 */ > + extern struct domain inet6domain; > +#endif > /* AF_ROUTE */ > extern struct domain routedomain; > /* AF_NETLINK */ > @@ -55,12 +64,20 @@ void net_init(void) > vnet_pfil_init(); > domaininit(NULL); > OSV_DOMAIN_SET(inet); > +#ifdef INET6 > + OSV_DOMAIN_SET(inet6); > +#endif > OSV_DOMAIN_SET(route); > OSV_DOMAIN_SET(netlink); > rts_init(); > route_init(); > vnet_route_init(); > netlink_init(); > +#ifdef INET6 > + ip6_init2(NULL); > + mld_init(NULL); > + vnet_mld_init(NULL); > +#endif > ipport_tick_init(NULL); > arp_init(); > domainfinalize(NULL); > @@ -68,9 +85,13 @@ void net_init(void) > if_attachdomain(NULL); > vnet_loif_init(); > > + /* Adding IPv4 address before starting the loopback interface > + * cause the interface to be brought up without IPv6 support. > + */ > + > /* Start the loopback device */ > - osv::start_if("lo0", "127.0.0.1", "255.0.0.0"); > osv::ifup("lo0"); > + osv::start_if("lo0", "127.0.0.1", "255.0.0.0"); > > debug(" - done\n"); > } > diff --git a/bsd/porting/netport.h b/bsd/porting/netport.h > index a433370..c797f25 100644 > --- a/bsd/porting/netport.h > +++ b/bsd/porting/netport.h > @@ -163,6 +163,10 @@ extern int tick; > #define INET (1) > #endif > > +#if defined(CONF_INET6) && (CONF_INET6 != 0) > + #define INET6 (1) > +#endif > + > #ifdef _KERNEL > > #define panic(...) do { tprintf_e("bsd-panic", __VA_ARGS__); \ > diff --git a/bsd/sys/dev/xen/netfront/netfront.cc > b/bsd/sys/dev/xen/netfront/netfront.cc > index c2b40ac..c4b40ba 100644 > --- a/bsd/sys/dev/xen/netfront/netfront.cc > +++ b/bsd/sys/dev/xen/netfront/netfront.cc > @@ -61,6 +61,10 @@ __FBSDID("$FreeBSD$"); > #include <bsd/sys/netinet/in_systm.h> > #include <bsd/sys/netinet/in.h> > #include <bsd/sys/netinet/ip.h> > +#ifdef INET6 > +#include <bsd/sys/netinet6/in6.h> > +#include <bsd/sys/netinet/ip6.h> > +#endif > #include <bsd/sys/netinet/if_ether.h> > #if __FreeBSD_version >= 700000 > #include <bsd/sys/netinet/tcp.h> > diff --git a/conf/base.mk b/conf/base.mk > index dcf98cd..54cd163 100644 > --- a/conf/base.mk > +++ b/conf/base.mk > @@ -9,3 +9,8 @@ conf-logger_debug=0 > # This macro controls the NDEBUG macro that is used to identify the debug > # build variant in the code. > conf-DEBUG_BUILD=0 > + > +# Set to 1 to enable IPV6 > +# This macro controls the FreeBSD INET6 macro defined in > bsd/porting/netport.h > +conf-INET6=1 > + > diff --git a/include/api/netinet/in.h b/include/api/netinet/in.h > index 18fa77f..1b6d3f3 100644 > --- a/include/api/netinet/in.h > +++ b/include/api/netinet/in.h > @@ -157,62 +157,16 @@ struct ip6_mtuinfo > uint32_t ip6m_mtu; > }; > > -#define IPV6_ADDRFORM 1 > -#define IPV6_2292PKTINFO 2 > -#define IPV6_2292HOPOPTS 3 > -#define IPV6_2292DSTOPTS 4 > -#define IPV6_2292RTHDR 5 > -#define IPV6_2292PKTOPTIONS 6 > -#define IPV6_CHECKSUM 7 > -#define IPV6_2292HOPLIMIT 8 > -#define SCM_SRCRT IPV6_RXSRCRT > -#define IPV6_NEXTHOP 9 > -#define IPV6_AUTHHDR 10 > -#define IPV6_UNICAST_HOPS 16 > -#define IPV6_MULTICAST_IF 17 > -#define IPV6_MULTICAST_HOPS 18 > -#define IPV6_MULTICAST_LOOP 19 > -#define IPV6_JOIN_GROUP 20 > -#define IPV6_LEAVE_GROUP 21 > -#define IPV6_ROUTER_ALERT 22 > -#define IPV6_MTU_DISCOVER 23 > -#define IPV6_MTU 24 > -#define IPV6_RECVERR 25 > -#define IPV6_V6ONLY 26 > -#define IPV6_JOIN_ANYCAST 27 > -#define IPV6_LEAVE_ANYCAST 28 > -#define IPV6_IPSEC_POLICY 34 > -#define IPV6_XFRM_POLICY 35 > - > -#define IPV6_RECVPKTINFO 49 > -#define IPV6_PKTINFO 50 > -#define IPV6_RECVHOPLIMIT 51 > -#define IPV6_HOPLIMIT 52 > -#define IPV6_RECVHOPOPTS 53 > -#define IPV6_HOPOPTS 54 > -#define IPV6_RTHDRDSTOPTS 55 > -#define IPV6_RECVRTHDR 56 > -#define IPV6_RTHDR 57 > -#define IPV6_RECVDSTOPTS 58 > -#define IPV6_DSTOPTS 59 > - > -#define IPV6_RECVTCLASS 66 > -#define IPV6_TCLASS 67 > - > -#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP > -#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP > -#define IPV6_RXHOPOPTS IPV6_HOPOPTS > -#define IPV6_RXDSTOPTS IPV6_DSTOPTS > +#include <netinet6/__in6.h> > What bothers me somewhat about this patch is that a header from include/api/ now includes something from outside api/ - which I think (?) we generally tried to avoid. Why can't these definitions stay in api/netinet/in.h - why did you want to move them to __in6.h? Is including netinet/in.h in the BSD code problematic? > > +#define SOL_IPV6 41 > +#define SOL_ICMPV6 58 > > #define IPV6_PMTUDISC_DONT 0 > #define IPV6_PMTUDISC_WANT 1 > #define IPV6_PMTUDISC_DO 2 > #define IPV6_PMTUDISC_PROBE 3 > > -#define SOL_IPV6 41 > -#define SOL_ICMPV6 58 > - > #define IPV6_RTHDR_LOOSE 0 > #define IPV6_RTHDR_STRICT 1 > > -- > 2.7.4 > > -- > You received this message because you are subscribed to the Google Groups > "OSv Development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
