- s = socket(PF_PACKET, SOCK_DGRAM, 0);
- ifindex = errno;
-
- setuid(getuid());
-
- {
- unsigned long opt;
- char *_count, *_timeout, *_device;
- opt = bb_getopt_ulflags(argc, argv, "DUAqfbc:w:i:s:",
- &_count, &_timeout, &_device);
- if (opt & 1) { /* Dad */
- cfg |= dad;
- cfg |= quit_on_reply;
- }
- if (opt & 2) /* Unsolicited */
- cfg |= unsolicited;
- if (opt & 4) { /* Advert */
- cfg |= advert;
- cfg |= unsolicited;
- }
- if (opt & 8) /* quiet */
- cfg |= quiet;
- if (opt & 16) /* quit on reply */
- cfg |= quit_on_reply;
- if (opt & 32) /* broadcast only */
- cfg |= broadcast_only;
- if (opt & 64) /* count */
- count = atoi(_count);
- if (opt & 128) /* timeout */
- timeout = atoi(_timeout);
- if (opt & 256) { /* interface */
- if (bb_strlen(_device) > IF_NAMESIZE) {
- bb_error_msg_and_die("Interface name `%s' must be less than %d",
- _device, IF_NAMESIZE);
- }
- device = _device;
- }
- if (opt & 512) /* source */
- source = optarg;
- }
- argc -= optind;
- argv += optind;