Re: Should we allow to configure twice the same IP?
On Tue, Oct 28, 2014 at 11:55:57AM +0100, Martin Pieuchot wrote: There's nothing that prevent you to configure the same IPv4 address on different interfaces in the same routing domain. But does it make sense? Yes, it does make sense. I abuse this feature to get unnumbered point-to-point links. Index: netinet/in.c === RCS file: /home/ncvs/src/sys/netinet/in.c,v retrieving revision 1.106 diff -u -p -r1.106 in.c --- netinet/in.c 7 Oct 2014 08:47:28 - 1.106 +++ netinet/in.c 28 Oct 2014 10:23:07 - @@ -616,6 +616,10 @@ in_ifinit(struct ifnet *ifp, struct in_i splsoftassert(IPL_SOFTNET); + /* Make sure this address does not exist in the given rdomain. */ + if (ifa_ifwithaddr(sintosa(sin), ifp-if_rdomain)) + return (EEXIST); + if (newaddr) TAILQ_INSERT_TAIL(in_ifaddr, ia, ia_list); -- :wq Claudio
Re: armv7: banana pi, Allwinner A20 board
On Mon, Oct 20, 2014 at 12:15:42PM +0200, Raphael Graf wrote: On Thu, October 16, 2014 11:40 pm, Patrick Wildt wrote: I do believe that this is a pmap issue. I just got hands on an Allwinner A20 and suffered the same issues: pool_setlowat crashing randomly, same for ahci and so on. I believe we are not syncing the PTEs correctly. Here?s the snippet from PTE_SYNC(), but PTE_SYNC_RANGE() has the same issue: #define PTE_SYNC(pte) \ do { \ if (PMAP_NEEDS_PTE_SYNC) { \ paddr_t pa; \ cpu_drain_writebuf(); \ cpu_dcache_wb_range((vaddr_t)(pte), sizeof(pt_entry_t));\ if (cpu_sdcache_enabled()) {\ (void)pmap_extract(pmap_kernel(), (vaddr_t)(pte), pa); \ cpu_sdcache_wb_range((vaddr_t)(pte), (paddr_t)(pa), \ sizeof(pt_entry_t));\ }; \ cpu_drain_writebuf(); \ } \ } while (/*CONSTCOND*/0) I believe that when we change things in the pagetables, we need to make sure the tables are synced before we?re going to use them. In our case we believe that we are using uncached pagetables, which means that every write will directly hit the tables. But that does not have an affect on the write buffer. The write buffer is still there and has to be cleared manually. If it isn?t, and something accesses an area which was just mapped, then we?re fucked. Therefore I firmly believe that the cpu_drain_writebuf() call has to be made regardless of PMAP_NEEDS_PTE_SYNC and that it has to be called before that if-clause. Doing that fixes my issues. \Patrick I think this is correct. With the diff below, my A20 board doesn't panic anymore. I still get a lot of messages like the following though: pmap_fault_fixup: va 8000 ftype 1 u pte 7f24f02e http://permalink.gmane.org/gmane.comp.hardware.netbook.arm.sunxi/3342 It seems Cortex A8/Allwinner A10 allocates cache lines on read and Cortex A7/Allwinner A20 allocates on write. Or rather the A7/A15 have inner shareable L2 unlike the A9/A8 which have external outer shareable L2 that affects the coherency. The current snapshot has this diff included, and was built on a kernel running it. Index: sys/arch/arm/include/pmap.h === RCS file: /cvs/src/sys/arch/arm/include/pmap.h,v retrieving revision 1.27 diff -u -p -u -p -r1.27 pmap.h --- sys/arch/arm/include/pmap.h 7 Oct 2014 10:10:58 - 1.27 +++ sys/arch/arm/include/pmap.h 20 Oct 2014 09:33:14 - @@ -328,9 +328,9 @@ extern int pmap_needs_pte_sync; #define PTE_SYNC(pte) \ do { \ + cpu_drain_writebuf(); \ if (PMAP_NEEDS_PTE_SYNC) { \ paddr_t pa; \ - cpu_drain_writebuf(); \ cpu_dcache_wb_range((vaddr_t)(pte), sizeof(pt_entry_t));\ if (cpu_sdcache_enabled()) {\ (void)pmap_extract(pmap_kernel(), (vaddr_t)(pte), pa); \ @@ -343,9 +343,9 @@ do { \ #define PTE_SYNC_RANGE(pte, cnt) \ do { \ + cpu_drain_writebuf(); \ if (PMAP_NEEDS_PTE_SYNC) { \ paddr_t pa; \ - cpu_drain_writebuf(); \ cpu_dcache_wb_range((vaddr_t)(pte), \ (cnt) 2); /* * sizeof(pt_entry_t) */ \ if (cpu_sdcache_enabled()) {\
Re: increase netcat's buffer...
Ping?
Re: pool page colouring
On Wed, Oct 29, 2014 at 07:25, David Gwynne wrote: if you want it to go fast, it would make more sense to set the item alignment in pool_init to the size of the cacheline. colouring would then become irrelevant from a speed perspective. There's some sense to this. Like round everything to nearest 64, except things less than 64 (round to 16 or 32).
Re: pool page colouring
On Wed, Oct 29, 2014 at 07:25, David Gwynne wrote: i dunno. im fine with either removing colouring altogether or setting it from something else completely. i just want a decision to be made cos right now ph_color isnt set, which is a bug. there. i fixed it. Index: kern/subr_pool.c === RCS file: /cvs/src/sys/kern/subr_pool.c,v retrieving revision 1.163 diff -u -p -r1.163 subr_pool.c --- kern/subr_pool.c13 Oct 2014 00:12:51 - 1.163 +++ kern/subr_pool.c29 Oct 2014 21:49:38 - @@ -82,7 +82,6 @@ struct pool_item_header { ph_node;/* Off-page page headers */ int ph_nmissing;/* # of chunks in use */ caddr_t ph_page;/* this page's address */ - caddr_t ph_colored; /* page's colored address */ u_long ph_magic; }; #define POOL_MAGICBIT (1 3) /* keep away from perturbed low bits */ @@ -217,7 +216,7 @@ void pool_init(struct pool *pp, size_t size, u_int align, u_int ioff, int flags, const char *wchan, struct pool_allocator *palloc) { - int off = 0, space; + int off = 0; unsigned int pgsize = PAGE_SIZE, items; #ifdef DIAGNOSTIC struct pool *iter; @@ -293,15 +292,6 @@ pool_init(struct pool *pp, size_t size, pp-pr_hardlimit_warning_last.tv_usec = 0; RB_INIT(pp-pr_phtree); - /* -* Use the space between the chunks and the page header -* for cache coloring. -*/ - space = POOL_INPGHDR(pp) ? pp-pr_phoffset : pp-pr_pgsize; - space -= pp-pr_itemsperpage * pp-pr_size; - pp-pr_maxcolor = (space / align) * align; - pp-pr_curcolor = 0; - pp-pr_nget = 0; pp-pr_nfail = 0; pp-pr_nput = 0; @@ -1232,7 +1222,7 @@ pool_walk(struct pool *pp, int full, int n; LIST_FOREACH(ph, pp-pr_fullpages, ph_pagelist) { - cp = ph-ph_colored; + cp = ph-ph_page; n = ph-ph_nmissing; while (n--) { @@ -1242,7 +1232,7 @@ pool_walk(struct pool *pp, int full, } LIST_FOREACH(ph, pp-pr_partpages, ph_pagelist) { - cp = ph-ph_colored; + cp = ph-ph_page; n = ph-ph_nmissing; do { Index: sys/pool.h === RCS file: /cvs/src/sys/sys/pool.h,v retrieving revision 1.53 diff -u -p -r1.53 pool.h --- sys/pool.h 22 Sep 2014 01:04:58 - 1.53 +++ sys/pool.h 29 Oct 2014 21:49:43 - @@ -128,8 +128,6 @@ struct pool { RB_HEAD(phtree, pool_item_header) pr_phtree; - int pr_maxcolor;/* Cache colouring */ - int pr_curcolor; int pr_phoffset;/* Offset in page of page header */ /*
Re: pool page colouring
On 29 October 2014 22:52, Ted Unangst t...@tedunangst.com wrote: On Wed, Oct 29, 2014 at 07:25, David Gwynne wrote: i dunno. im fine with either removing colouring altogether or setting it from something else completely. i just want a decision to be made cos right now ph_color isnt set, which is a bug. there. i fixed it. so is there any performance difference?
Re: wrong mac address used with carp and unnumbered carpdevs
ola, while your explanation is good it still makes my head hurt. i think it makes sense, but i will throw it on a box here to try. we use both numbered and unnumbered carpdevs. dlg On 28 Oct 2014, at 23:56, Henning Brauer hb-openbsdt...@ml.bsws.de wrote: so, carp interface with underlaying unnumbered carpdev, i. e. ifconfig em1 up ifconfig carp0 carpdev em1 vhid 0 ... 10.0.0.1/24 carp announcements and some stuff like arp goes out with the carp interface mac address, fine. however, IP traffic goes out with the carpdev's mac, which is wrong and leads to problems in places with a strict mac address regime - exchange points are a typical case. the culprit is sys/net/if_ethersubr.c ether_output(). The ifp passed to ether_output is (usually) determined by looking up the route to the destination and grabbing the ifp from it. So in the numbered carpdev case (em1 10.0.0.x/24, carp 10.0.0.y/32) it'll be the carpdev (em1 here) right away. In the unnumbered carpdev case, it'll be the carp interface itself. ether_output has a hack to exchange the carp ifp with the carpdev's one, to send out the frame on the carpdev and not the carp if. This little hack is before the src mac address is determined tho, and that is the bug. ok? Index: if_ethersubr.c === RCS file: /cvs/src/sys/net/if_ethersubr.c,v retrieving revision 1.175 diff -u -p -r1.175 if_ethersubr.c --- if_ethersubr.c7 Oct 2014 20:23:32 - 1.175 +++ if_ethersubr.c28 Oct 2014 12:18:36 - @@ -270,6 +270,8 @@ ether_output(struct ifnet *ifp0, struct senderr(EBUSY); #endif + esrc = ac-ac_enaddr; + #if NCARP 0 if (ifp-if_type == IFT_CARP) { ifp = ifp-if_carpdev; @@ -310,7 +312,6 @@ ether_output(struct ifnet *ifp0, struct time_second rt-rt_rmx.rmx_expire) senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH); } - esrc = ac-ac_enaddr; switch (dst-sa_family) { #ifdef INET -- Henning Brauer, h...@bsws.de, henn...@openbsd.org BS Web Services GmbH, http://bsws.de, Full-Service ISP Secure Hosting, Mail and DNS. Virtual Dedicated Servers, Root to Fully Managed Henning Brauer Consulting, http://henningbrauer.com/
ressl: two way fds extention
Hello, This diff enables libressl to use two file descriptors for read and write. This is feature is necessary for communication over two pipes like in the UCSPI protocol [1]. resslc[3] is a general ssl-client. +---+ ++ ++ | tcpserver | -- | resslc | -- | client | | | -- || -- || +---+ ++ ++ This diff adds a new function ressl_set_fds() to set a separate file descriptors for read and write inside of the ressl context structure. The function ressl_connect_socket() sets the read and write file descriptors if their were set before. I also adapt the related manpage. This approach may not the best to get this feature. I am open to every idea that solves this problem in a better way. I am not sure whether it is nessacery to touch shlib_version. So, I leave it untouched. I tried to test this diff with regress/lib/libressl, but it seems to be brocken. Thanks, Jan Background: To port one of the sslserver versions to ressl is not possible in my situation, because this is not flexible enough. I often have to use the port net/ucspi-tcp together with socks[2]. This fits perfectly into the UCSPI protocol. It is my plan to port socks and resslc like net/ucspi-tcp later, too. +---+ +---+ ++ ++ | tcpserver | -- | socks | -- | resslc | -- | client | | | -- | | -- || -- || +---+ +---+ ++ ++ [1]: http://cr.yp.to/proto/ucspi.txt [2]: https://github.com/younix/ucspi/blob/master/socks.c [3]: https://github.com/younix/ucspi/blob/master/resslc.c Index: Makefile === RCS file: /cvs/src/lib/libressl/Makefile,v retrieving revision 1.5 diff -u -p -r1.5 Makefile --- Makefile8 Oct 2014 19:01:40 - 1.5 +++ Makefile30 Oct 2014 00:24:04 - @@ -27,6 +27,7 @@ MLINKS+=ressl_init.3 ressl_set_cert_file MLINKS+=ressl_init.3 ressl_set_cert_mem.3 MLINKS+=ressl_init.3 ressl_set_ciphers.3 MLINKS+=ressl_init.3 ressl_set_ecdhcurve.3 +MLINKS+=ressl_init.3 ressl_set_fds.3 MLINKS+=ressl_init.3 ressl_set_key_file.3 MLINKS+=ressl_init.3 ressl_set_key_mem.3 MLINKS+=ressl_init.3 ressl_set_protocols.3 Index: ressl.c === RCS file: /cvs/src/lib/libressl/ressl.c,v retrieving revision 1.18 diff -u -p -r1.18 ressl.c --- ressl.c 15 Oct 2014 21:02:39 - 1.18 +++ ressl.c 30 Oct 2014 00:24:04 - @@ -73,6 +73,20 @@ ressl_set_error(struct ressl *ctx, char return (rv); } +int +ressl_set_fds(struct ressl *ctx, int fd_read, int fd_write) +{ + if (fd_read 0 || fd_write 0) { + ressl_set_error(ctx, failed to set fds); + return (1); + } + + ctx-socket_read = fd_read; + ctx-socket_write = fd_write; + + return (0); +} + struct ressl * ressl_new(void) { @@ -218,6 +232,8 @@ ressl_reset(struct ressl *ctx) ctx-ssl_ctx = NULL; ctx-socket = -1; + ctx-socket_read = -1; + ctx-socket_write = -1; ctx-err = 0; free(ctx-errmsg); Index: ressl.h === RCS file: /cvs/src/lib/libressl/ressl.h,v retrieving revision 1.21 diff -u -p -r1.21 ressl.h --- ressl.h 15 Oct 2014 21:02:39 - 1.21 +++ ressl.h 30 Oct 2014 00:24:04 - @@ -71,6 +71,7 @@ void ressl_free(struct ressl *ctx); int ressl_accept(struct ressl *ctx, struct ressl **cctx); int ressl_accept_socket(struct ressl *ctx, struct ressl **cctx, int socket); int ressl_connect(struct ressl *ctx, const char *host, const char *port); +int ressl_set_fds(struct ressl *ctx, int read_fd, int write_fd); int ressl_connect_socket(struct ressl *ctx, int s, const char *hostname); int ressl_listen(struct ressl *ctx, const char *host, const char *port, int af); int ressl_read(struct ressl *ctx, void *buf, size_t buflen, size_t *outlen); Index: ressl_client.c === RCS file: /cvs/src/lib/libressl/ressl_client.c,v retrieving revision 1.5 diff -u -p -r1.5 ressl_client.c --- ressl_client.c 3 Oct 2014 14:14:40 - 1.5 +++ ressl_client.c 30 Oct 2014 00:24:05 - @@ -166,7 +166,14 @@ ressl_connect_socket(struct ressl *ctx, ressl_set_error(ctx, ssl connection failure); goto err; } - if (SSL_set_fd(ctx-ssl_conn, ctx-socket) != 1) { + + if (ctx-socket_read != -1 ctx-socket_write != -1) { + if (SSL_set_rfd(ctx-ssl_conn, ctx-socket_read) != 1 || + SSL_set_wfd(ctx-ssl_conn, ctx-socket_write) != 1) { + ressl_set_error(ctx, ssl file descriptor failure); + goto err; + } + } else if (SSL_set_fd(ctx-ssl_conn, ctx-socket) != 1) {
libevent evutil.h
Hi, libevent has compatibilty wrappers in evutil. Our tree does not use them anymore, but they are still part of libevent's interface. I don't want to include them automatically, so I suggest to remove evutil.h from event.h. A version bump should not be necessary as the library itself does not change. Does my idea make sense? Is a full ports build needed with this diff? bluhm Index: lib/libevent/event.h === RCS file: /data/mirror/openbsd/cvs/src/lib/libevent/event.h,v retrieving revision 1.27 diff -u -p -r1.27 event.h --- lib/libevent/event.h8 Oct 2014 20:14:19 - 1.27 +++ lib/libevent/event.h29 Oct 2014 23:42:45 - @@ -168,8 +168,11 @@ extern C { #include stdarg.h #include stdint.h -/* For int types. */ -#include evutil.h +#define ev_uint64_t uint64_t +#define ev_int64_t int64_t +#define ev_uint32_t uint32_t +#define ev_uint16_t uint16_t +#define ev_uint8_t uint8_t #define EVLIST_TIMEOUT 0x01 #define EVLIST_INSERTED0x02