fix: Add IPOPT_RA definition & change cmdline option
This commit is contained in:
parent
2101768832
commit
5143b2b1de
1 changed files with 7 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include <libnet.h>
|
#include <libnet.h>
|
||||||
#include <netinet/igmp.h>
|
#include <netinet/igmp.h>
|
||||||
|
|
||||||
|
#define IPOPT_RA 148 /* router alert */
|
||||||
#define IGMP_V3_MEMBERSHIP_REPORT 0x22
|
#define IGMP_V3_MEMBERSHIP_REPORT 0x22
|
||||||
|
|
||||||
struct igmp_extra {
|
struct igmp_extra {
|
||||||
|
@ -82,11 +83,13 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
*cp++ = 0;
|
*cp++ = 0;
|
||||||
|
|
||||||
igmp_version = (u_short)atoi(cp);
|
// igmp_version = (u_short)atoi(cp);
|
||||||
|
igmp_version = (u_short)atoi(optarg);
|
||||||
|
|
||||||
pkt_ptr = g_igmp_pkts;
|
pkt_ptr = g_igmp_pkts;
|
||||||
while(pkt_ptr->igmp_version || pkt_ptr->igmp_tag){
|
while(pkt_ptr->igmp_version || pkt_ptr->igmp_tag){
|
||||||
if ((strcasecmp(pkt_ptr->igmp_tag, optarg) == 0)
|
// if ((strcasecmp(pkt_ptr->igmp_tag, optarg) == 0)
|
||||||
|
if ((strcasecmp(pkt_ptr->igmp_tag, cp) == 0)
|
||||||
&& (igmp_version == pkt_ptr->igmp_version)){
|
&& (igmp_version == pkt_ptr->igmp_version)){
|
||||||
found = 1;
|
found = 1;
|
||||||
igmp_type = pkt_ptr->igmp_type;
|
igmp_type = pkt_ptr->igmp_type;
|
||||||
|
@ -322,12 +325,12 @@ int main(int argc, char **argv)
|
||||||
void usage(char *name)
|
void usage(char *name)
|
||||||
{
|
{
|
||||||
struct igmp_extra *pkt_ptr;
|
struct igmp_extra *pkt_ptr;
|
||||||
fprintf(stderr, "usage: %s -i ethdevice -g group -t packet.version [-s ip:port] [-d ip:port]\n", name);
|
fprintf(stderr, "usage: %s -i ethdevice -g group -t version.packettype [-s ip:port] [-d ip:port]\n", name);
|
||||||
|
|
||||||
pkt_ptr = g_igmp_pkts;
|
pkt_ptr = g_igmp_pkts;
|
||||||
fprintf(stderr,"\nAvailable packet types:\n");
|
fprintf(stderr,"\nAvailable packet types:\n");
|
||||||
while(pkt_ptr->igmp_version || pkt_ptr->igmp_tag){
|
while(pkt_ptr->igmp_version || pkt_ptr->igmp_tag){
|
||||||
fprintf(stderr," - %s.%d\n", pkt_ptr->igmp_tag, pkt_ptr->igmp_version);
|
fprintf(stderr," - %d.%s\n", pkt_ptr->igmp_version, pkt_ptr->igmp_tag);
|
||||||
pkt_ptr++;
|
pkt_ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue