+sbappendaddr(
+ struct sockbuf* sb,
+ struct sockaddr* asa,
+ struct mbuf *m0,
+ struct mbuf *control,
+ int *error_out)
+{
+ int result = 0;
+
+ if (error_out) *error_out = 0;
+
+ if (m0 && (m0->m_flags & M_PKTHDR) == 0)
+ panic("sbappendaddrorfree");
+
+ /* Call socket data in filters */
+ if ((sb->sb_flags & SB_RECV) != 0) {
+ int error;
+ error = sflt_data_in(sb->sb_so, asa, &m0, &control, 0, NULL);
+ if (error) {
+ if (error != EJUSTRETURN) {
+ if (m0) m_freem(m0);
+ if (control) m_freem(control);
+ if (error_out) *error_out = error;
+ }
+ return 0;
+ }
+ }
+
+ result = sbappendaddr_internal(sb, asa, m0, control);
+ if (result == 0) {
+ if (m0) m_freem(m0);
+ if (control) m_freem(control);
+ if (error_out) *error_out = ENOBUFS;
+ }
+
+ return result;
+}
+
+static int
+sbappendcontrol_internal(sb, m0, control)