2016-06-22 2 views
2

誰でもSO_DEBUGとSO_DONTROUTEの違いを説明できますか?これはSO_DEBUGとSO_DONTROUTE in traceroute

SO_DONTROUTE

  Enable/disable routing bypass for outgoing message 

      Routing takes place only when it goes to out of subnet. 

      This tell that do not route, directly connect to the destination instead of routing 

      SO_DONTROUTE refers to the local routing 

      But default it is zero 

      Do not route send directly to the connected network 

      If the host is not on a directly-attached network 
    an error is returned. This option can be used to ping 
    a local host through an interface that has no route. 

SO_DEBUG

  When enabled, the kernel keeps track of detailed 
    information about the packets sent and received by TCP for the socket 

しかし、私は、コマンドラインで-dオプションを与えた場合のtracerouteで、SO_DONTROUTEオプションも有効になっている私の理解です。また、-rオプションを有効にすると-dも有効になります。なぜ分かるの?

+0

どのバージョンのtracerouteを使用していますか? – Malt

+0

最初のバージョンのtracerouteがvan Jacobsonによって書かれました – pretty

+0

'-d'が' SO_DONTROUTE'をオンにしたとあなたはどのように判断しましたか? – Malt

答えて

1

私は2つのフラグの間に明確な関係はないので、これはおそらく実装固有の動作であり、おそらくバグです。

Ubuntu 14.04マシンでtraceroute -d 8.8.8.8を実行しましたが、デフォルトのtracerouteがインストールされています(Modern traceroute for Linux, version 2.0.20, Aug 19 2014)。8.8.8.8に達しています。 -rフラグを指定すると、8.8.8.8が見つからないため、tracerouteはNetwork is unreachableというエラーメッセージで失敗します。私はまた、他の1はのみsetsockopt(3, SOL_SOCKET, SO_DEBUG, [1], 4)呼び出している間1は、のみsetsockopt(3, SOL_SOCKET, SO_DONTROUTE, [1], 4)呼び出すことを確認したtraceroute -rtraceroute -d両方のstraceを見る

official(?)のVan Jacobsonのtracerouteのソースは、同じ方法で動作する必要があります。ここ

case 'r': 
    options |= SO_DONTROUTE; 
    break; 

case 'd': 
    options |= SO_DEBUG; 
    break; 

され、ソケットオプション:ここでは、コマンドラインスイッチ解析するコードの(一部)である

if (options & SO_DEBUG) 
    (void)setsockopt(s, SOL_SOCKET, SO_DEBUG, (char *)&on, 
     sizeof(on)); 
if (options & SO_DONTROUTE) 
    (void)setsockopt(s, SOL_SOCKET, SO_DONTROUTE, (char *)&on, 
     sizeof(on)); 

しかし、おそらくソースが異なるバージョンからのものは..

+0

ありがとうございます。あなたの説明によると、私はtracerouteバージョン2.0.13、2009年11月23日に-dオプションを指定して実行しました。そして、私はSO_DEBUGオプションだけを有効にするstraceコマンドを調べます。あなたが言ったように、Van Jacobsonのtracerouteのバグかもしれません。ありがとうございました – pretty

+0

いずれのシナリオでもSO_DEBUGとSO_DONTROUTEの実例を教えてください – pretty

関連する問題