mtest.c (223510) | mtest.c (244538) |
---|---|
1/*- 2 * Copyright (c) 2007-2009 Bruce Simpson. 3 * Copyright (c) 2000 Wilbert De Graaf. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 23 unchanged lines hidden (view full) --- 32 * Diagnostic and test utility for multicast sockets. 33 * XXX: This file currently assumes INET support in the base system. 34 * TODO: Support embedded KAME Scope ID in IPv6 group addresses. 35 * TODO: Use IPv4 link-local address when source address selection 36 * is implemented; use MCAST_JOIN_SOURCE for IPv4. 37 */ 38 39#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2007-2009 Bruce Simpson. 3 * Copyright (c) 2000 Wilbert De Graaf. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 23 unchanged lines hidden (view full) --- 32 * Diagnostic and test utility for multicast sockets. 33 * XXX: This file currently assumes INET support in the base system. 34 * TODO: Support embedded KAME Scope ID in IPv6 group addresses. 35 * TODO: Use IPv4 link-local address when source address selection 36 * is implemented; use MCAST_JOIN_SOURCE for IPv4. 37 */ 38 39#include <sys/cdefs.h> |
40__FBSDID("$FreeBSD: head/usr.sbin/mtest/mtest.c 223510 2011-06-24 17:54:45Z jhb $"); | 40__FBSDID("$FreeBSD: head/usr.sbin/mtest/mtest.c 244538 2012-12-21 15:54:13Z kevlo $"); |
41 42#include <sys/types.h> 43#include <sys/param.h> 44#include <sys/errno.h> 45#include <sys/socket.h> 46#include <sys/time.h> 47#include <sys/ioctl.h> 48 --- 150 unchanged lines hidden (view full) --- 199 char line[LINE_LENGTH]; 200 char *p; 201 int i, s, s6; 202 203 s = -1; 204 s6 = -1; 205#ifdef INET 206 s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); | 41 42#include <sys/types.h> 43#include <sys/param.h> 44#include <sys/errno.h> 45#include <sys/socket.h> 46#include <sys/time.h> 47#include <sys/ioctl.h> 48 --- 150 unchanged lines hidden (view full) --- 199 char line[LINE_LENGTH]; 200 char *p; 201 int i, s, s6; 202 203 s = -1; 204 s6 = -1; 205#ifdef INET 206 s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); |
207 if (s == -1 && errno != EPROTONOSUPPORT) | 207 if (s == -1 && errno != EAFNOSUPPORT) |
208 err(1, "can't open IPv4 socket"); 209#endif 210#ifdef INET6 211 s6 = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); | 208 err(1, "can't open IPv4 socket"); 209#endif 210#ifdef INET6 211 s6 = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); |
212 if (s6 == -1 && errno != EPROTONOSUPPORT) | 212 if (s6 == -1 && errno != EAFNOSUPPORT) |
213 err(1, "can't open IPv6 socket"); 214#endif 215 if (s == -1 && s6 == -1) 216 errc(1, EPROTONOSUPPORT, "can't open socket"); 217 218 if (argc < 2) { 219 if (isatty(STDIN_FILENO)) { 220 printf("multicast membership test program; " --- 631 unchanged lines hidden --- | 213 err(1, "can't open IPv6 socket"); 214#endif 215 if (s == -1 && s6 == -1) 216 errc(1, EPROTONOSUPPORT, "can't open socket"); 217 218 if (argc < 2) { 219 if (isatty(STDIN_FILENO)) { 220 printf("multicast membership test program; " --- 631 unchanged lines hidden --- |