dns resolving error (boost)

Pierre Abbat phma at bezitopo.org
Mon Sep 16 22:58:15 PDT 2013


I'm writing a program that implements a network protocol I'm designing. It 
contains the following lines of code:

  conf>>otherend;
  ip::udp::resolver::query 
query(otherend,"2375",ip::udp::resolver::query::v4_mapped|
ip::udp::resolver::query::all_matching);
  ip::udp::resolver::iterator iter=resolver.resolve(query);
  ip::udp::resolver::iterator end;

I run it on two machines that try to send packets to each other. conf is a 
configuration file; on darner it contains "caracal" and on caracal it contains 
"darner". After this code it iterates through the result and both outputs it 
to the screen and constructs a list in memory.

On caracal, it prints both the IPv6 and the IPv4 addresses of darner. On 
darner, I get error 22, invalid argument. I know that DragonFly (at least as 
seen through boost) does not support sending IPv4 packets on an IPv6 socket, 
whereas Linux does, and I've written code that works on both OSes. It is 
immediately before the above code and is as follows:

  try
  {
    receivesocket[0]=new 
ip::udp::socket(io,ip::udp::endpoint(ip::udp::v6(),2375));
  }
  catch(boost::system::system_error e)
  {
  }
  try
  {
    receivesocket[1]=new 
ip::udp::socket(io,ip::udp::endpoint(ip::udp::v4(),2375));
  }
  catch(boost::system::system_error e)
  {
  }
  try
  {
    sendsocket[0]=new ip::udp::socket(io,ip::udp::endpoint(ip::udp::v6(),0));
  }
  catch(boost::system::system_error e)
  {
  }
  try
  {
    sendsocket[1]=new ip::udp::socket(io,ip::udp::endpoint(ip::udp::v4(),0));
  }
  catch(boost::system::system_error e)
  {
  }

If in the resolve query I remove the v4_mapped and all_matching flags and run 
it on darner, it gets caracal's IPv6 address. Caracal doesn't have an IPv4 
address in DNS because it's a laptop and gets the DHCP adresse du jour. If 
either of the flags is present, darner aborts with error 22. Why does darner 
abort, but not caracal?

Pierre
-- 
li ze te'a ci vu'u ci bi'e te'a mu du
li ci su'i ze te'a mu bi'e vu'u ci



More information about the Users mailing list