Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 May 2002 16:25:12 -0700 (PDT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 10616 for review
Message-ID:  <200205012325.g41NPC714407@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205012325.g41NPC714407>