Deleted Added
full compact
ip_divert.c (152242) ip_divert.c (157370)
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1993
3 * The Regents of the University of California. 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

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1993
3 * The Regents of the University of California. 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

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: head/sys/netinet/ip_divert.c 152242 2005-11-09 13:29:16Z ru $
29 * $FreeBSD: head/sys/netinet/ip_divert.c 157370 2006-04-01 15:42:02Z rwatson $
30 */
31
32#if !defined(KLD_MODULE)
33#include "opt_inet.h"
34#include "opt_ipfw.h"
35#include "opt_mac.h"
36#ifndef INET
37#error "IPDIVERT requires INET."

--- 381 unchanged lines hidden (view full) ---

419 INP_INFO_WUNLOCK(&divcbinfo);
420 inp->inp_ip_p = proto;
421 inp->inp_vflag |= INP_IPV4;
422 inp->inp_flags |= INP_HDRINCL;
423 INP_UNLOCK(inp);
424 return 0;
425}
426
30 */
31
32#if !defined(KLD_MODULE)
33#include "opt_inet.h"
34#include "opt_ipfw.h"
35#include "opt_mac.h"
36#ifndef INET
37#error "IPDIVERT requires INET."

--- 381 unchanged lines hidden (view full) ---

419 INP_INFO_WUNLOCK(&divcbinfo);
420 inp->inp_ip_p = proto;
421 inp->inp_vflag |= INP_IPV4;
422 inp->inp_flags |= INP_HDRINCL;
423 INP_UNLOCK(inp);
424 return 0;
425}
426
427static int
427static void
428div_detach(struct socket *so)
429{
430 struct inpcb *inp;
431
432 INP_INFO_WLOCK(&divcbinfo);
433 inp = sotoinpcb(so);
434 if (inp == 0) {
435 INP_INFO_WUNLOCK(&divcbinfo);
428div_detach(struct socket *so)
429{
430 struct inpcb *inp;
431
432 INP_INFO_WLOCK(&divcbinfo);
433 inp = sotoinpcb(so);
434 if (inp == 0) {
435 INP_INFO_WUNLOCK(&divcbinfo);
436 return EINVAL;
436 return;
437 }
438 INP_LOCK(inp);
439 in_pcbdetach(inp);
440 INP_INFO_WUNLOCK(&divcbinfo);
437 }
438 INP_LOCK(inp);
439 in_pcbdetach(inp);
440 INP_INFO_WUNLOCK(&divcbinfo);
441 return 0;
442}
443
444static int
445div_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
446{
447 struct inpcb *inp;
448 int error;
449

--- 277 unchanged lines hidden ---
441}
442
443static int
444div_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
445{
446 struct inpcb *inp;
447 int error;
448

--- 277 unchanged lines hidden ---