View | Details | Raw Unified | Return to bug 31891
Collapse All | Expand All

(-)sys/netinet/myloop_masklen.h (+7 lines)
Line 0 Link Here
1
#include "opt_myloop_masklen.h"
2
3
#ifndef MYLOOP_MASKLEN
4
#define	IN_MY_LOOP(i)		(((u_int32_t)(i) & IN_CLASSA_NET) == (IN_LOOPBACKNET << IN_CLASSA_NSHIFT))
5
#else
6
#define	IN_MY_LOOP(i)		(((u_int32_t)(i) & (INADDR_BROADCAST << (32 - MYLOOP_MASKLEN))) == (IN_LOOPBACKNET << IN_CLASSA_NSHIFT))
7
#endif
(-)sys/netinet/in.c (-2 / +3 lines)
Lines 48-53 Link Here
48
#include <net/route.h>
48
#include <net/route.h>
49
49
50
#include <netinet/in.h>
50
#include <netinet/in.h>
51
#include <netinet/myloop_masklen.h>
51
#include <netinet/in_var.h>
52
#include <netinet/in_var.h>
52
#include <netinet/in_pcb.h>
53
#include <netinet/in_pcb.h>
53
54
Lines 112-122 Link Here
112
	register u_long i = ntohl(in.s_addr);
113
	register u_long i = ntohl(in.s_addr);
113
	register u_long net;
114
	register u_long net;
114
115
115
	if (IN_EXPERIMENTAL(i) || IN_MULTICAST(i))
116
	if (IN_EXPERIMENTAL(i) || IN_MULTICAST(i) || IN_MY_LOOP(i))
116
		return (0);
117
		return (0);
117
	if (IN_CLASSA(i)) {
118
	if (IN_CLASSA(i)) {
118
		net = i & IN_CLASSA_NET;
119
		net = i & IN_CLASSA_NET;
119
		if (net == 0 || net == (IN_LOOPBACKNET << IN_CLASSA_NSHIFT))
120
		if (net == 0)
120
			return (0);
121
			return (0);
121
	}
122
	}
122
	return (1);
123
	return (1);
(-)sys/netinet/ip_icmp.c (-2 / +2 lines)
Lines 50-55 Link Here
50
50
51
#define _IP_VHL
51
#define _IP_VHL
52
#include <netinet/in.h>
52
#include <netinet/in.h>
53
#include <netinet/myloop_masklen.h>
53
#include <netinet/in_systm.h>
54
#include <netinet/in_systm.h>
54
#include <netinet/in_var.h>
55
#include <netinet/in_var.h>
55
#include <netinet/ip.h>
56
#include <netinet/ip.h>
Lines 612-619 Link Here
612
	int optlen = (IP_VHL_HL(ip->ip_vhl) << 2) - sizeof(struct ip);
613
	int optlen = (IP_VHL_HL(ip->ip_vhl) << 2) - sizeof(struct ip);
613
614
614
	if (!in_canforward(ip->ip_src) &&
615
	if (!in_canforward(ip->ip_src) &&
615
	    ((ntohl(ip->ip_src.s_addr) & IN_CLASSA_NET) !=
616
            !IN_MY_LOOP(ntohl(ip->ip_src.s_addr))) {
616
	     (IN_LOOPBACKNET << IN_CLASSA_NSHIFT))) {
617
		m_freem(m);	/* Bad return address */
617
		m_freem(m);	/* Bad return address */
618
		goto done;	/* Ip_output() will check for broadcast */
618
		goto done;	/* Ip_output() will check for broadcast */
619
	}
619
	}
(-)sys/netinet/ip_input.c (-2 / +4 lines)
Lines 65-70 Link Here
65
#include <net/intrq.h>
65
#include <net/intrq.h>
66
66
67
#include <netinet/in.h>
67
#include <netinet/in.h>
68
#include <netinet/myloop_masklen.h>
68
#include <netinet/in_systm.h>
69
#include <netinet/in_systm.h>
69
#include <netinet/in_var.h>
70
#include <netinet/in_var.h>
70
#include <netinet/ip.h>
71
#include <netinet/ip.h>
Lines 347-354 Link Here
347
	}
348
	}
348
349
349
	/* 127/8 must not appear on wire - RFC1122 */
350
	/* 127/8 must not appear on wire - RFC1122 */
350
	if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET ||
351
	/* Local change: 127/MYLOOP_MASKLEN */
351
	    (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) {
352
	if (IN_MY_LOOP(ntohl(ip->ip_dst.s_addr)) ||
353
	    IN_MY_LOOP(ntohl(ip->ip_src.s_addr))) {
352
		if ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) == 0) {
354
		if ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) == 0) {
353
			ipstat.ips_badaddr++;
355
			ipstat.ips_badaddr++;
354
			goto bad;
356
			goto bad;
(-)sys/i386/conf/LINT (+5 lines)
Lines 425-430 Link Here
425
# mchain library. It can be either loaded as KLD or compiled into kernel
425
# mchain library. It can be either loaded as KLD or compiled into kernel
426
options 	LIBMCHAIN		#mbuf management library
426
options 	LIBMCHAIN		#mbuf management library
427
427
428
# Usually kernel must to drop any external packet with src in 127/8
429
# But it is useful in clusters narrow this mask in kernel to use
430
# some nets in 127/8 for kernels interoperate in cluster.
431
options 	MYLOOP_MASKLEN=8
432
428
# netgraph(4). Enable the base netgraph code with the NETGRAPH option.
433
# netgraph(4). Enable the base netgraph code with the NETGRAPH option.
429
# Individual node types can be enabled with the corresponding option
434
# Individual node types can be enabled with the corresponding option
430
# listed below; however, this is not strictly necessary as netgraph
435
# listed below; however, this is not strictly necessary as netgraph
(-)sys/conf/options (+2 lines)
Lines 272-277 Link Here
272
TCPDEBUG
272
TCPDEBUG
273
TCP_DROP_SYNFIN		opt_tcp_input.h
273
TCP_DROP_SYNFIN		opt_tcp_input.h
274
XBONEHACK
274
XBONEHACK
275
# For interconnect beetween kernels in cluster
276
MYLOOP_MASKLEN
275
277
276
# Netgraph(4). Use option NETGRAPH to enable the base netgraph code.
278
# Netgraph(4). Use option NETGRAPH to enable the base netgraph code.
277
# Each netgraph node type can be either be compiled into the kernel
279
# Each netgraph node type can be either be compiled into the kernel

Return to bug 31891