ip_freef now void
[unix-history] / usr / src / sys / netinet / udp_usrreq.c
index dacf35f..0712363 100644 (file)
@@ -1,4 +1,4 @@
-/*     udp_usrreq.c    4.33    82/10/09        */
+/*     udp_usrreq.c    4.43    83/01/13        */
 
 #include "../h/param.h"
 #include "../h/dir.h"
 
 #include "../h/param.h"
 #include "../h/dir.h"
@@ -89,10 +89,8 @@ udp_input(m0)
            ui->ui_src, ui->ui_sport, ui->ui_dst, ui->ui_dport,
                INPLOOKUP_WILDCARD);
        if (inp == 0) {
            ui->ui_src, ui->ui_sport, ui->ui_dst, ui->ui_dport,
                INPLOOKUP_WILDCARD);
        if (inp == 0) {
-               struct in_addr broadcastaddr;
-
-               broadcastaddr = if_makeaddr(ui->ui_dst.s_net, INADDR_ANY);
-               if (ui->ui_dst.s_addr == broadcastaddr.s_addr)
+               /* don't send ICMP response for broadcast packet */
+               if (in_lnaof(ui->ui_dst) == INADDR_ANY)
                        goto bad;
                icmp_error((struct ip *)ui, ICMP_UNREACH, ICMP_UNREACH_PORT);
                return;
                        goto bad;
                icmp_error((struct ip *)ui, ICMP_UNREACH, ICMP_UNREACH_PORT);
                return;
@@ -148,7 +146,7 @@ udp_ctlinput(cmd, arg)
 
        default:
                sin = &((struct icmp *)arg)->icmp_ip.ip_dst;
 
        default:
                sin = &((struct icmp *)arg)->icmp_ip.ip_dst;
-               in_pcbnotify(&udb, sin, inetctlerrmap[cmd], udp_abort);
+               in_pcbnotify(&udb, sin, (int)inetctlerrmap[cmd], udp_abort);
        }
 }
 
        }
 }
 
@@ -167,7 +165,7 @@ udp_output(inp, m0)
         */
        for (m = m0; m; m = m->m_next)
                len += m->m_len;
         */
        for (m = m0; m; m = m->m_next)
                len += m->m_len;
-       m = m_get(M_DONTWAIT);
+       m = m_get(M_DONTWAIT, MT_HEADER);
        if (m == 0) {
                m_freem(m0);
                return (ENOBUFS);
        if (m == 0) {
                m_freem(m0);
                return (ENOBUFS);
@@ -204,11 +202,11 @@ udp_output(inp, m0)
            so->so_state & SS_PRIV));
 }
 
            so->so_state & SS_PRIV));
 }
 
-udp_usrreq(so, req, m, nam, opt)
+/*ARGSUSED*/
+udp_usrreq(so, req, m, nam)
        struct socket *so;
        int req;
        struct mbuf *m, *nam;
        struct socket *so;
        int req;
        struct mbuf *m, *nam;
-       struct socketopt *opt;
 {
        struct inpcb *inp = sotoinpcb(so);
        int error = 0;
 {
        struct inpcb *inp = sotoinpcb(so);
        int error = 0;
@@ -223,7 +221,7 @@ udp_usrreq(so, req, m, nam, opt)
                error = in_pcballoc(so, &udb);
                if (error)
                        break;
                error = in_pcballoc(so, &udb);
                if (error)
                        break;
-               error = in_pcbreserve(so, 2048, 2048);
+               error = soreserve(so, 2048, 2048);
                if (error)
                        break;
                break;
                if (error)
                        break;
                break;
@@ -243,7 +241,7 @@ udp_usrreq(so, req, m, nam, opt)
                break;
 
        case PRU_CONNECT:
                break;
 
        case PRU_CONNECT:
-               if (inp->inp_faddr.s_addr)
+               if (inp->inp_faddr.s_addr != INADDR_ANY)
                        return (EISCONN);
                error = in_pcbconnect(inp, nam);
                if (error == 0)
                        return (EISCONN);
                error = in_pcbconnect(inp, nam);
                if (error == 0)
@@ -254,7 +252,7 @@ udp_usrreq(so, req, m, nam, opt)
                return (EOPNOTSUPP);
 
        case PRU_DISCONNECT:
                return (EOPNOTSUPP);
 
        case PRU_DISCONNECT:
-               if (inp->inp_faddr.s_addr == 0)
+               if (inp->inp_faddr.s_addr == INADDR_ANY)
                        return (ENOTCONN);
                in_pcbdisconnect(inp);
                soisdisconnected(so);
                        return (ENOTCONN);
                in_pcbdisconnect(inp);
                soisdisconnected(so);
@@ -269,13 +267,13 @@ udp_usrreq(so, req, m, nam, opt)
 
                if (nam) {
                        laddr = inp->inp_laddr;
 
                if (nam) {
                        laddr = inp->inp_laddr;
-                       if (inp->inp_faddr.s_addr)
+                       if (inp->inp_faddr.s_addr != INADDR_ANY)
                                return (EISCONN);
                        error = in_pcbconnect(inp, nam);
                        if (error)
                                break;
                } else {
                                return (EISCONN);
                        error = in_pcbconnect(inp, nam);
                        if (error)
                                break;
                } else {
-                       if (inp->inp_faddr.s_addr == 0)
+                       if (inp->inp_faddr.s_addr == INADDR_ANY)
                                return (ENOTCONN);
                }
                error = udp_output(inp, m);
                                return (ENOTCONN);
                }
                error = udp_output(inp, m);