Skip to content

Commit

Permalink
fix set_option
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvid Norberg committed May 13, 2018
1 parent 480c43a commit ffaccc1
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions include/simulator/simulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ All rights reserved.
#include <list>
#include <functional>

#ifndef IP_DONTFRAGMENT
#define IP_DONTFRAGMENT 1
#endif

namespace sim
{
namespace aux
Expand Down Expand Up @@ -180,17 +184,19 @@ namespace sim
boost::system::error_code set_option(Option const& opt
, boost::system::error_code& ec)
{
Protocol const p = Protocol::v4();
(void)p;
#ifdef IP_DONTFRAG
if (opt.name(Protocol()) == IP_DONTFRAG)
m_dont_fragment = *opt.data(Protocol()) != 0;
if (opt.name(p) == IP_DONTFRAG)
m_dont_fragment = *reinterpret_cast<int const*>(opt.data(p)) != 0;
#endif
#ifdef IP_DONTFRAGMENT
if (opt.name(Protocol()) == IP_DONTFRAGMENT)
m_dont_fragment = *opt.data(Protocol()) != 0;
if (opt.name(p) == IP_DONTFRAGMENT)
m_dont_fragment = *reinterpret_cast<int const*>(opt.data(p)) != 0;
#endif
#ifdef IP_MTU_DISCOVER
if (opt.name(Protocol()) == IP_MTU_DISCOVER)
m_dont_fragment = *opt.data(Protocol()) == IP_PMTUDISC_DO;
if (opt.name(p) == IP_MTU_DISCOVER)
m_dont_fragment = *reinterpret_cast<int const*>(opt.data(p)) == IP_PMTUDISC_DO;
#endif
return ec;
}
Expand Down

0 comments on commit ffaccc1

Please sign in to comment.