[PATCH] ping.c: Add -t TTL support

Denys Vlasenko vda.linux at googlemail.com
Mon Nov 29 11:08:43 UTC 2010


On Mon, Nov 29, 2010 at 9:32 AM, Joachim Nilsson
<joachim.nilsson at vmlinux.org> wrote:
> On 11/28/2010 11:04 PM, Denys Vlasenko wrote:
>> On Sunday 21 November 2010 01:21, Joachim Nilsson wrote:
>>> Hi, maybe someone else is also interested in this.
>>>
>>> I was testing multicast routing (pimd) on a server today and needed a
>>> very simple multicast generator.  Calling BusyBox "ping 225.1.2.3" sends
>>> out a neat UDP multicast stream of one packet per second, simple enough
>>> for my purposes.  However, for multicast ICMP_ECHO defaults to a TTL of
>>> 1, whereas unicast gets 64.  Hence this little patch.
>>
>> I tested "standard" ping -t TTL and it uses:
>>
>> setsockopt(3, SOL_IP, IP_TTL, [<ttl_val>], 4);
>>
>> I changed IP_MULTICAST_TTL to IP_TTL that in your patch and applied it.
>> Please test current git and let me know if it doesn't work for you.
>
> Sorry, does not work. I modeled the code after netkit ping, which only
> sets the IP_MULTICAST_TTL. It seems the IP_TTL sockopt does not bite for
> multicast destination addresses, only unicast.

I added setting of IP_MULTICAST_TTL too, please try now.

-- 
vda


More information about the busybox mailing list