diff --git a/bsd/porting/netport.h b/bsd/porting/netport.h index fef163a8ce46dedc7fbb6ed642ff01e05536ee6e..455b56bdbe4ffcd015cbaa2c7a244a52279585f2 100644 --- a/bsd/porting/netport.h +++ b/bsd/porting/netport.h @@ -40,6 +40,7 @@ struct ucred { int __unused; }; +/* Implemented in bsd/sys/kern/subr_hash.c */ struct malloc_type; void hashdestroy(void *, struct malloc_type *, u_long); void *hashinit(int count, struct malloc_type *type, u_long *hashmask); diff --git a/bsd/sys/netinet/in_mcast.c b/bsd/sys/netinet/in_mcast.c index 98af92470f3cae0e7a2a8befc3cefbdf3515c99f..0c10c902385d6e6fe66080515a7427e1dab24c86 100644 --- a/bsd/sys/netinet/in_mcast.c +++ b/bsd/sys/netinet/in_mcast.c @@ -90,6 +90,7 @@ MALLOC_DEFINE(M_IPMSOURCE, "ip_msource", * any need for in_multi itself to be virtualized -- it is bound to an ifp * anyway no matter what happens. */ +/* FIXME: OSv - find a better place to initialize by calling mtx_init() */ struct mtx in_multi_mtx = {0}; /* diff --git a/bsd/sys/netinet/in_pcb.c b/bsd/sys/netinet/in_pcb.c index 4d4d5b894b6cf7dd11ddcd38e06d7cfba129f78c..37841e12fdaaffd28c523b9a37fc6d43859d40c2 100644 --- a/bsd/sys/netinet/in_pcb.c +++ b/bsd/sys/netinet/in_pcb.c @@ -222,8 +222,7 @@ in_pcbinfo_init(struct inpcbinfo *pcbinfo, const char *name, pcbinfo->ipi_zone = uma_zcreate(inpcbzone_name, sizeof(struct inpcb), NULL, NULL, inpcbzone_init, inpcbzone_fini, UMA_ALIGN_PTR, inpcbzone_flags); - // FIXME: OSv, uncomment when we have a slab allocator */ - // uma_zone_set_max(pcbinfo->ipi_zone, maxsockets); + uma_zone_set_max(pcbinfo->ipi_zone, maxsockets); } /* @@ -737,7 +736,7 @@ in_pcbladdr(struct inpcb *inp, struct in_addr *faddr, struct in_addr *laddr, } IF_ADDR_RUNLOCK(ifp); - error = EAFNOSUPPORT; + error = 0; goto done; } @@ -1087,8 +1086,6 @@ in_pcbfree(struct inpcb *inp) #endif inp->inp_vflag = 0; inp->inp_flags2 |= INP_FREED; - /* FIXME: OSv - re-think user credentials */ - // crfree(inp->inp_cred); #ifdef MAC mac_inpcb_destroy(inp); #endif diff --git a/bsd/sys/netinet/in_var.h b/bsd/sys/netinet/in_var.h index fc7e3c60ad2f14c3731db3275e54dc37960cc5e4..646b55e3c6855e66b51453b76b35ab59b095d2b6 100644 --- a/bsd/sys/netinet/in_var.h +++ b/bsd/sys/netinet/in_var.h @@ -114,7 +114,6 @@ VNET_DECLARE(u_long, in_ifaddrhmask); /* mask for hash table */ #define INADDR_HASH(x) \ (&V_in_ifaddrhashtbl[INADDR_HASHVAL(x) & V_in_ifaddrhmask]) -#if 0 extern struct rwlock in_ifaddr_lock; #define IN_IFADDR_LOCK_ASSERT() rw_assert(&in_ifaddr_lock, RA_LOCKED) @@ -124,17 +123,6 @@ extern struct rwlock in_ifaddr_lock; #define IN_IFADDR_WLOCK() rw_wlock(&in_ifaddr_lock) #define IN_IFADDR_WLOCK_ASSERT() rw_assert(&in_ifaddr_lock, RA_WLOCKED) #define IN_IFADDR_WUNLOCK() rw_wunlock(&in_ifaddr_lock) -#else - -#define IN_IFADDR_LOCK_ASSERT() do{}while(0) -#define IN_IFADDR_RLOCK() do{}while(0) -#define IN_IFADDR_RLOCK_ASSERT() do{}while(0) -#define IN_IFADDR_RUNLOCK() do{}while(0) -#define IN_IFADDR_WLOCK() do{}while(0) -#define IN_IFADDR_WLOCK_ASSERT() do{}while(0) -#define IN_IFADDR_WUNLOCK() do{}while(0) - -#endif /* * Macro for finding the internet address structure (in_ifaddr) diff --git a/bsd/sys/netinet/ip_icmp.c b/bsd/sys/netinet/ip_icmp.c index 68504579b3271666cd47744c53e8e6bbfdbb7167..32f08c01a059b2368cea59f26f2888652c129839 100644 --- a/bsd/sys/netinet/ip_icmp.c +++ b/bsd/sys/netinet/ip_icmp.c @@ -813,13 +813,7 @@ match: * add on any record-route or timestamp options. */ cp = (u_char *) (ip + 1); - /* FIXME: OSv - enable when we have ip options */ -#if 0 if ((opts = ip_srcroute(m)) == 0 && -#else - opts = 0; - if (opts && -#endif (opts = m_gethdr(M_DONTWAIT, MT_DATA))) { opts->m_len = sizeof(struct in_addr); mtod(opts, struct in_addr *)->s_addr = 0; diff --git a/bsd/sys/netinet/ip_id.c b/bsd/sys/netinet/ip_id.c index bdd374e31e0137390473d88465406ecf9d0e7a1e..5c9cdac1e3e1b834d912c4c4c600c857c83042d9 100644 --- a/bsd/sys/netinet/ip_id.c +++ b/bsd/sys/netinet/ip_id.c @@ -101,20 +101,9 @@ void ip_initid(void) array_ptr = 0; size_t bits_sz = bitstr_size(65536); id_array = (u_int16_t *) malloc(array_size * sizeof(u_int16_t)); - id_bits = (bitstr_t *) malloc(bits_sz); - if (id_array == NULL || id_bits == NULL) { - /* Neither or both. */ - if (id_array != NULL) { - free(id_array); - id_array = NULL; - } - if (id_bits != NULL) { - free(id_bits); - id_bits = NULL; - } - } - bzero(id_array, array_size * sizeof(u_int16_t)); + + id_bits = (bitstr_t *) malloc(bits_sz); bzero(id_bits, bits_sz); } diff --git a/bsd/sys/netinet/ip_input.c b/bsd/sys/netinet/ip_input.c index a6d967c33f0d54a109db6b26f26f1f039501dcdb..0b8b6f7a8b6f93623bad898e20a30c6343d37c76 100644 --- a/bsd/sys/netinet/ip_input.c +++ b/bsd/sys/netinet/ip_input.c @@ -69,7 +69,8 @@ CTASSERT(sizeof(struct ip) == 20); #endif -struct rwlock in_ifaddr_lock; +/* FIXME: OSv - find a better place to initialize this mutex */ +struct rwlock in_ifaddr_lock = {0}; RW_SYSINIT(in_ifaddr_lock, &in_ifaddr_lock, "in_ifaddr_lock"); VNET_DEFINE(int, rsvp_on); diff --git a/bsd/sys/netinet/raw_ip.c b/bsd/sys/netinet/raw_ip.c index c6d7675ba71109b8be0f28d2afb5e0ee395b05cb..9f31dfb67b1404a675e15b49f236627a79415180 100644 --- a/bsd/sys/netinet/raw_ip.c +++ b/bsd/sys/netinet/raw_ip.c @@ -181,8 +181,8 @@ rip_delhash(struct inpcb *inp) static void rip_zone_change(void *tag) { - /* FIXME: OSv */ - // uma_zone_set_max(V_ripcbinfo.ipi_zone, maxsockets); + + uma_zone_set_max(V_ripcbinfo.ipi_zone, maxsockets); } static int @@ -977,7 +977,7 @@ rip_pcblist(SYSCTL_HANDLER_ARGS) if (error) return (error); - inp_list = malloc(n * sizeof *inp_list); + inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK); if (inp_list == 0) return (ENOMEM); @@ -1036,7 +1036,7 @@ rip_pcblist(SYSCTL_HANDLER_ARGS) INP_INFO_RUNLOCK(&V_ripcbinfo); error = SYSCTL_OUT(req, &xig, sizeof xig); } - free(inp_list); + free(inp_list, M_TEMP); return (error); }