PERFORCE change 176403 for review
Ana Kukec
anchie at FreeBSD.org
Thu Apr 1 11:56:32 UTC 2010
http://p4web.freebsd.org/chv.cgi?CH=176403
Change 176403 by anchie at anchie_malimis on 2010/04/01 11:56:27
Code cleanup: removing old routing socket related code.
Affected files ...
.. //depot/projects/soc2009/anchie_send/src/sys/net/rtsock.c#23 edit
.. //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.c#40 edit
.. //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.h#19 edit
Differences ...
==== //depot/projects/soc2009/anchie_send/src/sys/net/rtsock.c#23 (text+ko) ====
@@ -106,7 +106,6 @@
static struct mbuf *rt_msg1(int type, struct rt_addrinfo *rtinfo);
static int rt_msg2(int type, struct rt_addrinfo *rtinfo,
caddr_t cp, struct walkarg *w);
-static void rt_msg3(struct mbuf *, void *, size_t);
static int rt_xaddrs(caddr_t cp, caddr_t cplim,
struct rt_addrinfo *rtinfo);
static int sysctl_dumpentry(struct radix_node *rn, void *vw);
@@ -502,14 +501,12 @@
senderr(EINVAL);
}
info.rti_flags = rtm->rtm_flags;
- if (rtm->rtm_type != RTM_SND) {
if (info.rti_info[RTAX_DST] == NULL ||
info.rti_info[RTAX_DST]->sa_family >= AF_MAX ||
(info.rti_info[RTAX_GATEWAY] != NULL &&
info.rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX)) {
senderr(EINVAL);
}
- }
/*
* Verify that the caller has the appropriate privilege; RTM_GET
* is the only operation the non-superuser is allowed.
@@ -556,44 +553,6 @@
switch (rtm->rtm_type) {
struct rtentry *saved_nrt;
- case RTM_SND:
- switch (rtm->rtm_seq) {
- struct mbuf *n;
-
- case RTM_SND_IN:
- ifp = ifnet_byindex(rtm->rtm_index);
- if (!ifp)
- senderr(EINVAL);
-
- if ((n = m_dup(m, M_DONTWAIT)) == NULL)
- senderr(ENOBUFS);
- m_adj(n, sizeof(struct rt_msghdr));
-
- printf("%s: RTM_SND_IN ifp=%p(%s), mbuf=%p\n",
- __func__, ifp, ifp->if_xname, n);
- error = send_output_hook(n, ifp, SND_IN);
- if (error)
- senderr(error);
- goto flush;
- case RTM_SND_OUT:
- ifp = ifnet_byindex(rtm->rtm_index);
- if (!ifp)
- senderr(EINVAL);
-
- if ((n = m_dup(m, M_DONTWAIT)) == NULL)
- senderr(ENOBUFS);
- m_adj(n, sizeof(struct rt_msghdr));
-
- printf("%s: RTM_SND_OUT ifp=%p(%s), mbuf=%p\n",
- __func__, ifp, ifp->if_xname, n);
- error = send_output_hook(n, ifp, SND_OUT);
- if (error)
- senderr(error);
- goto flush;
- default:
- senderr(EOPNOTSUPP);
- }
-
case RTM_ADD:
if (info.rti_info[RTAX_GATEWAY] == NULL)
senderr(EINVAL);
@@ -988,7 +947,6 @@
case RTM_IFANNOUNCE:
case RTM_IEEE80211:
- case RTM_SND:
len = sizeof(struct if_announcemsghdr);
break;
@@ -1281,66 +1239,6 @@
}
/*
- * Generation of the routing socket message indicating SeND event.
- */
-void
-rt_securendmsg(struct ifnet *ifp, int direction, void *data, size_t data_len)
-{
- struct mbuf *m = NULL;
- struct rt_addrinfo info;
-
- switch (direction) {
- case SND_IN:
- /* Incoming traffic sent to userspace for SeND validation. */
- m = rt_makeifannouncemsg(ifp, RTM_SND, RTM_SND_IN, &info);
- break;
- case SND_OUT:
- /* Outgoing traffic sent to userspace for SeND protection. */
- m = rt_makeifannouncemsg(ifp, RTM_SND, RTM_SND_OUT, &info);
- break;
- }
-
- rt_msg3(m, data, data_len);
-}
-
-void
-rt_msg3(struct mbuf *m, void *data, size_t data_len)
-{
-
- if (m != NULL) {
- /*
- * Append the ieee80211 or ND/SEND data. Try to stick it in the
- * mbuf containing the ifannounce msg; otherwise allocate
- * a new mbuf and append.
- *
- * NB: we assume m is a single mbuf.
- */
-
- m_copyback(m, m->m_len, data_len, data);
-#if 0
- if (data_len > M_TRAILINGSPACE(m)) {
- struct mbuf *n = m_get(M_NOWAIT, MT_DATA);
- if (n == NULL) {
- m_freem(m);
- return;
- }
- bcopy(data, mtod(n, void *), data_len);
- printf("rtsock.c: rt_msg3(), nakon bcopy!\n");
- n->m_len = data_len;
- m->m_next = n;
- } else if (data_len > 0) {
- bcopy(data, mtod(m, u_int8_t *) + m->m_len, data_len);
- m->m_len += data_len;
- }
- if (m->m_flags & M_PKTHDR)
- m->m_pkthdr.len += data_len;
-#endif
- mtod(m, struct if_announcemsghdr *)->ifan_msglen += data_len;
- rt_dispatch(m, NULL);
- }
-}
-
-/*
* This is called to generate routing socket messages indicating
* IEEE80211 wireless events.
* XXX we piggyback on the RTM_IFANNOUNCE msg format in a clumsy way.
@@ -1352,10 +1250,6 @@
struct rt_addrinfo info;
m = rt_makeifannouncemsg(ifp, RTM_IEEE80211, what, &info);
-
- rt_msg3(m, data, data_len);
-
-#if 0
if (m != NULL) {
/*
* Append the ieee80211 data. Try to stick it in the
@@ -1382,7 +1276,6 @@
mtod(m, struct if_announcemsghdr *)->ifan_msglen += data_len;
rt_dispatch(m, NULL);
}
-#endif
}
/*
==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.c#40 (text+ko) ====
@@ -161,7 +161,7 @@
if (V_send_so != NULL)
return (EEXIST);
- /* XXX: Revisit this, hardocoded! */
+ /* XXX: Revisit this, hardocoded! This was a hack for PR_ATOMIC. */
/* so->so_snd.sb_hiwat = 8192; */
V_send_so = so;
@@ -180,9 +180,6 @@
snd_hdr = mtod(m, struct snd_hdr *);
- int mlen = m->m_len;
- int mpkthdrlen = m->m_pkthdr.len;
-
struct mbuf *m0;
m0 = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
if (m0 == NULL) {
@@ -191,9 +188,6 @@
}
m_move_pkthdr(m, m0);
- m->m_len = mlen;
- m->m_pkthdr.len = mpkthdrlen;
-
ifp = ifnet_byindex_ref(snd_hdr->ifidx);
m_adj(m, SEND_HDR_LEN);
m_fixhdr(m);
==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.h#19 (text+ko) ====
@@ -27,9 +27,6 @@
#define SND_OUT 0 /* Outgoing traffic */
#define SND_IN 1 /* Incoming traffic. */
-#define RTM_SND_OUT 0 /* Outgoing RTM SeND packet sent to user space */
-#define RTM_SND_IN 1 /* Incoming RTM SeND packet sent to user space */
-
#define SEND_HDR_LEN sizeof(struct snd_hdr)
struct snd_hdr {
@@ -37,7 +34,4 @@
int ifidx;
};
-extern int (*send_input_hook)(struct mbuf *, struct ifnet *, int, int);
-extern int (*send_output_hook)(struct mbuf *, struct ifnet *, int);
-
extern int (*send_sendso_input_hook)(struct socket *, struct mbuf *, int, int);
More information about the p4-projects
mailing list