fix: Add IPOPT_RA definition & change command-line option

This commit is contained in:
Glenn Y. Rolland 2009-09-14 23:52:55 +02:00
parent 88a813272c
commit 3691e3ac29

View file

@ -5,6 +5,7 @@
#include <libnet.h>
#include <netinet/igmp.h>
#define IPOPT_RA 148 /* router alert */
#define IGMP_V3_MEMBERSHIP_REPORT 0x22
/* Structure to represent IGMP extra information */
@ -32,12 +33,12 @@ struct igmp_extra {
void usage(char *name)
{
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;
fprintf(stderr,"\nAvailable packet types:\n");
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++;
}
}
@ -96,11 +97,13 @@ int main(int argc, char **argv)
}
*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;
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)){
found = 1;
igmp_type = pkt_ptr->igmp_type;