summaryrefslogtreecommitdiffstats
path: root/rtemsbsd
diff options
context:
space:
mode:
authorJennifer Averett <jennifer.averett@oarcorp.com>2012-03-27 15:26:10 -0500
committerJennifer Averett <jennifer.averett@oarcorp.com>2012-03-27 15:26:10 -0500
commit55fbb18365e878636775c3157fc8c18e801dafc8 (patch)
tree35ab497ff51c69068c8011d4461698cdd508843f /rtemsbsd
parentMoved prison_free and prison_hold to rtems-bsd-jail.c (diff)
downloadrtems-libbsd-55fbb18365e878636775c3157fc8c18e801dafc8.tar.bz2
Added empty/defaulted prison methods to for linking RealTek Nic.
Diffstat (limited to 'rtemsbsd')
-rw-r--r--rtemsbsd/src/rtems-bsd-jail.c109
1 files changed, 109 insertions, 0 deletions
diff --git a/rtemsbsd/src/rtems-bsd-jail.c b/rtemsbsd/src/rtems-bsd-jail.c
index ac4d14cc..10b1c16b 100644
--- a/rtemsbsd/src/rtems-bsd-jail.c
+++ b/rtemsbsd/src/rtems-bsd-jail.c
@@ -90,8 +90,117 @@ struct prison prison0 = {
};
MTX_SYSINIT(prison0, &prison0.pr_mtx, "jail mutex", MTX_DEF);
+/*
+ * See if a prison has the specific flag set.
+ */
+int
+prison_flag(struct ucred *cred, unsigned flag)
+{
+
+ /* This is an atomic read, so no locking is necessary. */
+ return (cred->cr_prison->pr_flags & flag);
+}
+
void prison_free(struct prison *pr) {}
void prison_hold(struct prison *pr) {}
+/*
+ * Check if given address belongs to the jail referenced by cred (wrapper to
+ * prison_check_ip[46]).
+ *
+ * Returns 0 if jail doesn't restrict the address family or if address belongs
+ * to jail, EADDRNOTAVAIL if the address doesn't belong, or EAFNOSUPPORT if
+ * the jail doesn't allow the address family. IPv4 Address passed in in NBO.
+ */
+int
+prison_if(struct ucred *cred, struct sockaddr *sa)
+{
+ return 0;
+}
+/*
+ * Return 1 if we should do proper source address selection or are not jailed.
+ * We will return 0 if we should bypass source address selection in favour
+ * of the primary jail IPv6 address. Only in this case *ia will be updated and
+ * returned in NBO.
+ * Return EAFNOSUPPORT, in case this jail does not allow IPv6.
+ */
+int
+prison_saddrsel_ip6(struct ucred *cred, struct in6_addr *ia6)
+{
+ return EAFNOSUPPORT;
+}
+/*
+ * Return true if pr1 and pr2 have the same IPv4 address restrictions.
+ */
+int
+prison_equal_ip4(struct prison *pr1, struct prison *pr2)
+{
+ return 1;
+}
+
+int
+prison_check_ip6(struct ucred *cred, struct in6_addr *ia6)
+{
+ return EAFNOSUPPORT;
+}
+/*
+ * Make sure our (source) address is set to something meaningful to this
+ * jail.
+ *
+ * Returns 0 if jail doesn't restrict IPv4 or if address belongs to jail,
+ * EADDRNOTAVAIL if the address doesn't belong, or EAFNOSUPPORT if the jail
+ * doesn't allow IPv4. Address passed in in NBO and returned in NBO.
+ */
+int
+prison_local_ip4(struct ucred *cred, struct in_addr *ia)
+{
+ return EAFNOSUPPORT;
+}
+
+/*
+ * Rewrite destination address in case we will connect to loopback address.
+ *
+ * Returns 0 on success, EAFNOSUPPORT if the jail doesn't allow IPv4.
+ * Address passed in in NBO and returned in NBO.
+ */
+int
+prison_remote_ip4(struct ucred *cred, struct in_addr *ia)
+{
+ return EAFNOSUPPORT;
+}
+/*
+ * Return true if pr1 and pr2 have the same IPv6 address restrictions.
+ */
+int
+prison_equal_ip6(struct prison *pr1, struct prison *pr2)
+{
+ return 1;
+}
+/*
+ * Make sure our (source) address is set to something meaningful to this jail.
+ *
+ * v6only should be set based on (inp->inp_flags & IN6P_IPV6_V6ONLY != 0)
+ * when needed while binding.
+ *
+ * Returns 0 if jail doesn't restrict IPv6 or if address belongs to jail,
+ * EADDRNOTAVAIL if the address doesn't belong, or EAFNOSUPPORT if the jail
+ * doesn't allow IPv6.
+ */
+int
+prison_local_ip6(struct ucred *cred, struct in6_addr *ia6, int v6only)
+{
+ return EAFNOSUPPORT;
+}
+
+/*
+ * Rewrite destination address in case we will connect to loopback address.
+ *
+ * Returns 0 on success, EAFNOSUPPORT if the jail doesn't allow IPv6.
+ */
+int
+prison_remote_ip6(struct ucred *cred, struct in6_addr *ia6)
+{
+ return EAFNOSUPPORT;
+}