iputils: ping by mark
Subsystems (2)
PATCH 1/1 iputils: ping by mark
I am CCing this to netdev. Can someone help me poke on Yoshifuji-san? I cant reach him using electrons or complex physical molecules...
cheers,
jamal
commit 7afb1e52ecc8bda3677f8b7db8433486936d473f
Author: Jamal Hadi Salim <[email protected]> Date: Mon Oct 12 16:59:27 2009 -0400
[PATCH] iputils: ping by mark
This extends ping to send a packet out based on a given
mark using -m option. Useful with policy routing to take different paths to same destination ..
ping.c +1 -1
@@ -1216,7 +1216,7 @@ void usage(void)fprintf (stderr,"Usage: ping [-LRUbdfnqrvVaA] [-c count] [-i interval] [-w deadline]\n" " [-p pattern] [-s packetsize] [-t ttl] [-I interface or address]\n" -" [-M mtu discovery hint] [-S sndbuf]\n" +" [-M mtu discovery hint] [-m mark] [-S sndbuf]\n" " [ -T timestamp option ] [ -Q tos ] [hop1 ...] destination\n" );exit (2 ); }
ping_common.c +21 -0
@@ -4,6 +4,7 @@int options; +int mark;int sndbuf;int ttl;int rtt;
@@ -141,6 +142,17 @@ void common_options(int ch) options |=F_INTERVAL ;break ; } +case 'm' : + { +char *endp; + mark = (int )strtoul (optarg, &endp,10 ); +if (mark <0 || *endp !='\0' ) { +fprintf (stderr,"mark cannot be negative" ); +exit (2 ); + } + options |=F_MARK ; +break ; + }case 'w' : deadline =atoi (optarg);if (deadline <0 ) {
@@ -442,6 +454,15 @@ void setup(int icmp_sock) fprintf(stderr, "Warning: no SO_TIMESTAMP support, falling back to SIOCGSTAMP\n"); }#endif +if (options &F_MARK ) { +if (setsockopt (icmp_sock,SOL_SOCKET ,SO_MARK , + &mark,sizeof (mark)) ==-1 ) { +/* we probably dont wanna exit since old kernels +* dont support mark .. +*/ +fprintf (stderr,"Warning: Failed to set mark %d\n" , mark); + } + }/* Set some SNDTIMEO to prevent blocking forever * on sends, when device is too slow or stalls. Just put limit
ping_common.h +3 -2
@@ -60,6 +60,7 @@ extern int options;#define F_STRICTSOURCE 0x8000#define F_NOLOOP 0x10000#define F_TTL 0x20000 +#define F_MARK 0x40000/* * MAX_DUP_CHK is the number of bits in received table, i.e. the maximum
@@ -118,9 +119,9 @@ case 'a': case 'U': case 'c': case 'd': \case 'f' :case 'i' :case 'w' :case 'l' : \case 'S' :case 'n' :case 'p' :case 'q' : \case 'r' :case 's' :case 'v' :case 'L' : \ -case 't' :case 'A' :case 'W' :case 'B' : +case 't' :case 'A' :case 'W' :case 'B' :case 'm' : -#define COMMON_OPTSTR "h?VQ:I:M:aUc:dfi:w:l:S:np:qrs:vLt:AW:B" +#define COMMON_OPTSTR "h?VQ:I:M:aUc:dfi:w:l:S:np:qrs:vLt:AW:Bm:"/*
I notice this mail. I'll investigate the patch.
Thanks.
--yoshfuji
Quoted 8 lines · jamal
I am CCing this to netdev. Can someone help me poke on Yoshifuji-san? I cant reach him using electrons or complex physical molecules...
cheers,
jamal
Hello.
Okay, applied. Thank you.
Could you give me patch for doc/ping.sgml as well, please?
Regards,
--yoshfuji
Quoted 8 lines · jamal
I am CCing this to netdev. Can someone help me poke on Yoshifuji-san? I cant reach him using electrons or complex physical molecules...
cheers,
jamal
Quoted 4 lines · YOSHIFUJI Hideaki
Hello.
Okay, applied. Thank you.
Could you give me patch for doc/ping.sgml as well, please?
Ok, here it is..
cheers,
jamal
commit 6e063d914a97c4b8160cb43a3129ea368b2a3fbb
Author: Jamal Hadi Salim <[email protected]> Date: Sat Feb 13 11:19:13 2010 -0500
iputils: ping by mark doc update
Update documentation for ping by-mark
doc/ping.sgml +9 -0
@@ -16,6 +16,7 @@ <command>ping</command> <arg choice="opt"><option>-LRUbdfnqrvVaAB</option></arg> <arg choice="opt">-c <replaceable/count/</arg> +<arg choice="opt">-m <replaceable/mark/</arg> <arg choice="opt">-i <replaceable/interval/</arg> <arg choice="opt">-l <replaceable/preload/</arg> <arg choice="opt">-p <replaceable/pattern/</arg>
@@ -76,6 +77,14 @@ The address is bound to one selected when <command/ping/ starts. </para></listitem> </varlistentry> <varlistentry> + <term><option>-m <replaceable/mark/</option></term> + <listitem><para> +use <replaceable/mark/ to tag the packets going out. This is useful +for variety of reasons within the kernel such as using policy +routing to select specific outbound processing. + </para></listitem> + </varlistentry> + <varlistentry> <term><option><anchor id="ping.count">-c <replaceable/count/</option></term> <listitem><para> Stop after sending <replaceable/count/ ECHO_REQUEST
YOSHIFUJI Hideaki
AppliedApplied. Thanks.
Quoted 11 lines · jamal
Quoted 4 lines · YOSHIFUJI Hideaki
Hello.
Okay, applied. Thank you.
Could you give me patch for doc/ping.sgml as well, please?Ok, here it is..
cheers,
jamal