Hi Willy, Baptiste! Patch is working for me. Thank you very much for help!
2017-01-06 21:53 GMT+03:00 Willy Tarreau <[email protected]>: > Hi Baptiste, Maxim, > > On Wed, Dec 28, 2016 at 02:04:44PM +0100, Baptiste wrote: > > On Fri, Dec 23, 2016 at 5:21 PM, Willy Tarreau <[email protected]> wrote: > > > Regarding this issue, I think that in fact we should decide to split > the > > > server port apart from the address. After all, we're manipulating the > port > > > and the address separately everywhere, we even have some extra > settings in > > > other places (eg the fact that the ports are relative). I have not yet > > > analysed the impact of all of this but I think that's definitely > something > > > we need to consider for the mid term. It will also remove most of the > > > "switch (family)" needed to retrieve/manipulate ports. > (...) > > I tend to fully agree if you mean having a "service_port" parameter in > the > > "struct server" (or some kind of) > > Each time we have to manipulate addr and/or port in the struct > > sockaddr_storage, it's a nightmare and we have to think about all the > > corner cases... > > OK so I managed to do it and I think I got it working fine now. It took > some time because in order not to miss any place I renamed the struct > member so that I was sure to spot all places. > > I found a small bug in the current DNS resolution implementation when the > family is set to AF_UNSPEC, it immediately marks it as invalid and tries > again, so my DNS server got flooded during my tests :-) But that's fixed > now. > > Thus now str2sa_range() doesn't change the family if the address doesn't > resolved. It however continues to *also* copy the port into the address > in the case where it resolves so that we don't have to touch all other > call places (listeners, peers, source, etc). I could get this config to > resolve all addresses as expected : > > resolvers mydns > nameserver dns1 8.8.8.8:53 > resolve_retries 3 > timeout retry 1s > hold valid 1s > > defaults > option httplog > log 127.0.0.1:5514 local0 > mode http > timeout connect 5s > timeout client 60s > timeout server 90s > > frontend f > bind *:8888 > #bind :::8888 > > backend b > # default-server resolvers mydns ## doesn't work > server s1 127.0.0.1:8000 check > server s2 127.0.0.2:8000 check disabled > server s3 wtap.haproxy.local:8000 init-addr none check > resolvers mydns > server s4 haproxy.ipv6.1wt.eu:80 init-addr none check > resolvers mydns > server s5 www6.1wt.eu:80 > server s6 [email protected]:80 > server s7 [email protected]:80 init-addr libc > server s8 1wt.eu:80 resolve-prefer ipv6 check init-addr none > resolvers mydns > server s9 1wt.eu:80 resolve-prefer ipv4 check > > By the way I found that "resolvers" doesn't work in default-server AND > doesn't emit any warning so I had to specify it on each line. We need to > fix this before issuing 1.7.2. > > I'd like you guys to take a look at the attached patches (rebased on 1.7). > There's also an all-in-one patch that you can apply to latest 1.7 snapshot > Maxim if you're interested. > > For me it passes all tests and seems to be OK now. > > Barring any objection, I'll merge all of them into 1.7 and will make a note > for distro maintainers to properly pick them or they'll get annoying bug > reports. > > Thanks, > Willy >

