From owner-p4-projects Wed May 1 16:25:21 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2FD6C37B400; Wed, 1 May 2002 16:25:14 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 3712837B41D for ; Wed, 1 May 2002 16:25:13 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g41NPC714407 for perforce@freebsd.org; Wed, 1 May 2002 16:25:12 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Wed, 1 May 2002 16:25:12 -0700 (PDT) Message-Id: <200205012325.g41NPC714407@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson Subject: PERFORCE change 10616 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=10616 Change 10616 by rwatson@rwatson_curry on 2002/05/01 16:24:40 Implement socket peer labeling for new unix domain socket and TCP socket connections. Note: the entry points here may change, this is a WIP. Affected files ... ... //depot/projects/trustedbsd/mac/sys/kern/uipc_usrreq.c#14 edit ... //depot/projects/trustedbsd/mac/sys/netinet/tcp_input.c#13 edit ... //depot/projects/trustedbsd/mac/sys/netinet/tcp_syncache.c#10 edit Differences ... ==== //depot/projects/trustedbsd/mac/sys/kern/uipc_usrreq.c#14 (text+ko) ==== @@ -739,6 +739,11 @@ sizeof(unp->unp_peercred)); unp->unp_flags |= UNP_HAVEPC; +#ifdef MAC + mac_set_socket_peer_from_socket(so, so3); + mac_set_socket_peer_from_socket(so3, so); +#endif + so2 = so3; } error = unp_connect2(so, so2); ==== //depot/projects/trustedbsd/mac/sys/netinet/tcp_input.c#13 (text+ko) ==== @@ -1149,6 +1149,9 @@ tp->t_flags &= ~TF_RCVD_CC; tcpstat.tcps_connects++; soisconnected(so); +#ifdef MAC + mac_set_socket_peer_from_mbuf(m, so); +#endif /* Do window scaling on this connection? */ if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) == (TF_RCVD_SCALE|TF_REQ_SCALE)) { ==== //depot/projects/trustedbsd/mac/sys/netinet/tcp_syncache.c#10 (text+ko) ==== @@ -97,7 +97,8 @@ static void syncache_insert(struct syncache *, struct syncache_head *); struct syncache *syncache_lookup(struct in_conninfo *, struct syncache_head **); static int syncache_respond(struct syncache *, struct mbuf *); -static struct socket *syncache_socket(struct syncache *, struct socket *); +static struct socket *syncache_socket(struct syncache *, struct socket *, + struct mbuf *m); static void syncache_timer(void *); static u_int32_t syncookie_generate(struct syncache *); static struct syncache *syncookie_lookup(struct in_conninfo *, @@ -526,9 +527,10 @@ * Build a new TCP socket structure from a syncache entry. */ static struct socket * -syncache_socket(sc, lso) +syncache_socket(sc, lso, m) struct syncache *sc; struct socket *lso; + struct mbuf *m; { struct inpcb *inp = NULL; struct socket *so; @@ -549,6 +551,9 @@ tcpstat.tcps_listendrop++; goto abort; } +#ifdef MAC + mac_set_socket_peer_from_mbuf(m, so); +#endif inp = sotoinpcb(so); @@ -756,7 +761,7 @@ if (th->th_ack != sc->sc_iss + 1) return (0); - so = syncache_socket(sc, *sop); + so = syncache_socket(sc, *sop, m); if (so == NULL) { #if 0 resetandabort: @@ -985,7 +990,7 @@ taop != NULL && taop->tao_cc != 0 && CC_GT(to->to_cc, taop->tao_cc)) { sc->sc_rxtslot = 0; - so = syncache_socket(sc, *sop); + so = syncache_socket(sc, *sop, m); if (so != NULL) { sc->sc_flags |= SCF_KEEPROUTE; taop->tao_cc = to->to_cc; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message