diff --git a/src/igmpgen.c b/src/igmpgen.c index b220fd0..af2bdad 100644 --- a/src/igmpgen.c +++ b/src/igmpgen.c @@ -5,6 +5,7 @@ #include #include +#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;