ip_fil_freebsd.c (369246) | ip_fil_freebsd.c (369273) |
---|---|
1/* $FreeBSD: stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c 369246 2021-02-09 13:47:51Z cy $ */ | 1/* $FreeBSD: stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c 369273 2021-02-16 00:48:28Z cy $ */ |
2 3/* 4 * Copyright (C) 2012 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 */ 8#if !defined(lint) 9static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed"; --- 279 unchanged lines hidden (view full) --- 289 ioctlcmd_t cmd; 290 caddr_t data; 291 int mode; 292{ 293 int error = 0, unit = 0; 294 SPL_INT(s); 295 296 CURVNET_SET(TD_TO_VNET(p)); | 2 3/* 4 * Copyright (C) 2012 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 */ 8#if !defined(lint) 9static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed"; --- 279 unchanged lines hidden (view full) --- 289 ioctlcmd_t cmd; 290 caddr_t data; 291 int mode; 292{ 293 int error = 0, unit = 0; 294 SPL_INT(s); 295 296 CURVNET_SET(TD_TO_VNET(p)); |
297#if (BSD >= 199306) | |
298 if (securelevel_ge(p->p_cred, 3) && (mode & FWRITE)) 299 { 300 V_ipfmain.ipf_interror = 130001; 301 CURVNET_RESTORE(); 302 return EPERM; 303 } | 297 if (securelevel_ge(p->p_cred, 3) && (mode & FWRITE)) 298 { 299 V_ipfmain.ipf_interror = 130001; 300 CURVNET_RESTORE(); 301 return EPERM; 302 } |
304#endif | |
305 306 unit = GET_MINOR(dev); 307 if ((IPL_LOGMAX < unit) || (unit < 0)) { 308 V_ipfmain.ipf_interror = 130002; 309 CURVNET_RESTORE(); 310 return ENXIO; 311 } 312 --- 70 unchanged lines hidden (view full) --- 383 if (sizeof(*tcp2) + hlen > MLEN) { 384 if (!(MCLGET(m, M_NOWAIT))) { 385 FREE_MB_T(m); 386 return -1; 387 } 388 } 389 390 m->m_len = sizeof(*tcp2) + hlen; | 303 304 unit = GET_MINOR(dev); 305 if ((IPL_LOGMAX < unit) || (unit < 0)) { 306 V_ipfmain.ipf_interror = 130002; 307 CURVNET_RESTORE(); 308 return ENXIO; 309 } 310 --- 70 unchanged lines hidden (view full) --- 381 if (sizeof(*tcp2) + hlen > MLEN) { 382 if (!(MCLGET(m, M_NOWAIT))) { 383 FREE_MB_T(m); 384 return -1; 385 } 386 } 387 388 m->m_len = sizeof(*tcp2) + hlen; |
391#if (BSD >= 199103) | |
392 m->m_data += max_linkhdr; 393 m->m_pkthdr.len = m->m_len; 394 m->m_pkthdr.rcvif = (struct ifnet *)0; | 389 m->m_data += max_linkhdr; 390 m->m_pkthdr.len = m->m_len; 391 m->m_pkthdr.rcvif = (struct ifnet *)0; |
395#endif | |
396 ip = mtod(m, struct ip *); 397 bzero((char *)ip, hlen); 398#ifdef USE_INET6 399 ip6 = (ip6_t *)ip; 400#endif 401 tcp2 = (struct tcphdr *)((char *)ip + hlen); 402 tcp2->th_sport = tcp->th_dport; 403 tcp2->th_dport = tcp->th_sport; --- 1083 unchanged lines hidden --- | 392 ip = mtod(m, struct ip *); 393 bzero((char *)ip, hlen); 394#ifdef USE_INET6 395 ip6 = (ip6_t *)ip; 396#endif 397 tcp2 = (struct tcphdr *)((char *)ip + hlen); 398 tcp2->th_sport = tcp->th_dport; 399 tcp2->th_dport = tcp->th_sport; --- 1083 unchanged lines hidden --- |