net: tcp: Don't increment snd.nxt
[akaros.git] / kern / src / net / udp.c
index faf78fb..da58226 100644 (file)
@@ -156,6 +156,15 @@ static void udpconnect(struct conv *c, char **argv, int argc)
        iphtadd(&upriv->ht, c);
 }
 
+static void udpbind(struct conv *c, char **argv, int argc)
+{
+       Udppriv *upriv;
+
+       upriv = c->p->priv;
+       Fsstdbind(c, argv, argc);
+       iphtadd(&upriv->ht, c);
+}
+
 static int udpstate(struct conv *c, char *state, int n)
 {
        return snprintf(state, n, "%s qin %d qout %d\n",
@@ -322,6 +331,7 @@ void udpkick(void *x, struct block *bp)
                                   ~ptclcsum(bp, UDP4_PHDR_OFF, UDP4_PHDR_SZ));
                        bp->checksum_start = UDP4_IPHDR_SZ;
                        bp->checksum_offset = uh4->udpcksum - uh4->udpsport;
+                       bp->transport_header_end = UDP4_IPHDR_SZ;
                        bp->flag |= Budpck;
                        uh4->vihl = IP_VER4;
                        ipoput4(f, bp, 0, c->ttl, c->tos, rc);
@@ -360,6 +370,7 @@ void udpkick(void *x, struct block *bp)
                                   ptclcsum(bp, UDP6_PHDR_OFF,
                                                        dlen + UDP_UDPHDR_SZ + UDP6_PHDR_SZ));
                        memset(uh6, 0, 8);
+                       bp->transport_header_end = UDP6_IPHDR_SZ;
                        uh6->viclfl[0] = IP_VER6;
                        hnputs(uh6->len, ptcllen);
                        uh6->nextheader = IP_UDPPROTO;
@@ -669,6 +680,7 @@ void udpinit(struct Fs *fs)
        udp->priv = kzmalloc(sizeof(Udppriv), 0);
        udp->name = "udp";
        udp->connect = udpconnect;
+       udp->bind = udpbind;
        udp->announce = udpannounce;
        udp->bypass = udpbypass;
        udp->ctl = udpctl;
@@ -679,7 +691,7 @@ void udpinit(struct Fs *fs)
        udp->advise = udpadvise;
        udp->stats = udpstats;
        udp->ipproto = IP_UDPPROTO;
-       udp->nc = Nchans;
+       udp->nc = 4096;
        udp->ptclsize = sizeof(Udpcb);
 
        Fsproto(fs, udp);