ipsockopt.c (166437) | ipsockopt.c (168548) |
---|---|
1/*- 2 * Copyright (c) 2004 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2004 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/tools/regression/netinet/ipsockopt/ipsockopt.c 166437 2007-02-02 21:10:37Z bms $ | 26 * $FreeBSD: head/tools/regression/netinet/ipsockopt/ipsockopt.c 168548 2007-04-09 19:44:08Z bms $ |
27 */ 28 29#include <sys/types.h> 30#include <sys/socket.h> 31 32#include <netinet/in.h> 33#include <netinet/in_systm.h> 34#include <netinet/ip.h> --- 640 unchanged lines hidden (view full) --- 675 basegroup = 0xEE010100; /* 238.1.1.0 */ 676 } 677 /* 678 * Join the multicast group(s) on the default multicast interface; 679 * this usually maps to the interface to which the default 680 * route is pointing. 681 */ 682 for (i = 0; i < nmcastgroups; i++) { | 27 */ 28 29#include <sys/types.h> 30#include <sys/socket.h> 31 32#include <netinet/in.h> 33#include <netinet/in_systm.h> 34#include <netinet/ip.h> --- 640 unchanged lines hidden (view full) --- 675 basegroup = 0xEE010100; /* 238.1.1.0 */ 676 } 677 /* 678 * Join the multicast group(s) on the default multicast interface; 679 * this usually maps to the interface to which the default 680 * route is pointing. 681 */ 682 for (i = 0; i < nmcastgroups; i++) { |
683 mreq.imr_multiaddr.s_addr = htonl((basegroup | i)); | 683 mreq.imr_multiaddr.s_addr = htonl((basegroup + i)); |
684 mreq.imr_interface.s_addr = INADDR_ANY; 685 inet_ntop(AF_INET, &mreq.imr_multiaddr, addrbuf, sizeof(addrbuf)); 686 if (verbose) 687 fprintf(stderr, "IP_ADD_MEMBERSHIP %s INADDR_ANY\n", addrbuf); 688 if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, 689 sizeof(mreq)) < 0) { 690 err(-1, 691"test_ip_multicast_membership(%d, %s): failed IP_ADD_MEMBERSHIP (%s, %s)", 692 sock, socktypename, addrbuf, "INADDR_ANY"); 693 } 694 } 695 for (i = 0; i < nmcastgroups; i++) { | 684 mreq.imr_interface.s_addr = INADDR_ANY; 685 inet_ntop(AF_INET, &mreq.imr_multiaddr, addrbuf, sizeof(addrbuf)); 686 if (verbose) 687 fprintf(stderr, "IP_ADD_MEMBERSHIP %s INADDR_ANY\n", addrbuf); 688 if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, 689 sizeof(mreq)) < 0) { 690 err(-1, 691"test_ip_multicast_membership(%d, %s): failed IP_ADD_MEMBERSHIP (%s, %s)", 692 sock, socktypename, addrbuf, "INADDR_ANY"); 693 } 694 } 695 for (i = 0; i < nmcastgroups; i++) { |
696 mreq.imr_multiaddr.s_addr = htonl((basegroup | i)); | 696 mreq.imr_multiaddr.s_addr = htonl((basegroup + i)); |
697 mreq.imr_interface.s_addr = INADDR_ANY; 698 inet_ntop(AF_INET, &mreq.imr_multiaddr, addrbuf, sizeof(addrbuf)); 699 if (verbose) 700 fprintf(stderr, "IP_DROP_MEMBERSHIP %s INADDR_ANY\n", addrbuf); 701 if (setsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, 702 sizeof(mreq)) < 0) { 703 err(-1, 704"test_ip_multicast_membership(%d, %s): failed IP_DROP_MEMBERSHIP (%s, %s)", --- 239 unchanged lines hidden --- | 697 mreq.imr_interface.s_addr = INADDR_ANY; 698 inet_ntop(AF_INET, &mreq.imr_multiaddr, addrbuf, sizeof(addrbuf)); 699 if (verbose) 700 fprintf(stderr, "IP_DROP_MEMBERSHIP %s INADDR_ANY\n", addrbuf); 701 if (setsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, 702 sizeof(mreq)) < 0) { 703 err(-1, 704"test_ip_multicast_membership(%d, %s): failed IP_DROP_MEMBERSHIP (%s, %s)", --- 239 unchanged lines hidden --- |