kernel/ip: remove nil checks for allocb() and padblock()
This commit is contained in:
parent
5cbffd6e6b
commit
99cc56f2e9
5 changed files with 1 additions and 22 deletions
|
@ -297,13 +297,9 @@ grekick(void *x, Block *bp)
|
||||||
|
|
||||||
/* Make space to fit ip header (gre header already there) */
|
/* Make space to fit ip header (gre header already there) */
|
||||||
bp = padblock(bp, GRE_IPONLY);
|
bp = padblock(bp, GRE_IPONLY);
|
||||||
if(bp == nil)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* make sure the message has a GRE header */
|
/* make sure the message has a GRE header */
|
||||||
bp = pullupblock(bp, GRE_IPONLY+GRE_IPPLUSGRE);
|
bp = pullupblock(bp, GRE_IPONLY+GRE_IPPLUSGRE);
|
||||||
if(bp == nil)
|
|
||||||
return;
|
|
||||||
|
|
||||||
gre = (GREhdr *)bp->rp;
|
gre = (GREhdr *)bp->rp;
|
||||||
gre->vihl = IP_VER4;
|
gre->vihl = IP_VER4;
|
||||||
|
|
|
@ -90,8 +90,6 @@ igmpsendreport(Medium *m, uchar *addr)
|
||||||
Block *bp;
|
Block *bp;
|
||||||
|
|
||||||
bp = allocb(sizeof(IGMPpkt));
|
bp = allocb(sizeof(IGMPpkt));
|
||||||
if(bp == nil)
|
|
||||||
return;
|
|
||||||
p = (IGMPpkt*)bp->wp;
|
p = (IGMPpkt*)bp->wp;
|
||||||
p->vihl = IP_VER4;
|
p->vihl = IP_VER4;
|
||||||
bp->wp += IGMPPKTSZ;
|
bp->wp += IGMPPKTSZ;
|
||||||
|
|
|
@ -384,9 +384,6 @@ rudpkick(void *x)
|
||||||
|
|
||||||
/* Make space to fit rudp & ip header */
|
/* Make space to fit rudp & ip header */
|
||||||
bp = padblock(bp, UDP_IPHDR+UDP_RHDRSIZE);
|
bp = padblock(bp, UDP_IPHDR+UDP_RHDRSIZE);
|
||||||
if(bp == nil)
|
|
||||||
return;
|
|
||||||
|
|
||||||
uh = (Udphdr *)(bp->rp);
|
uh = (Udphdr *)(bp->rp);
|
||||||
uh->vihl = IP_VER4;
|
uh->vihl = IP_VER4;
|
||||||
|
|
||||||
|
@ -955,8 +952,6 @@ relsendack(Conv *c, Reliable *r, int hangup)
|
||||||
Fs *f;
|
Fs *f;
|
||||||
|
|
||||||
bp = allocb(UDP_IPHDR + UDP_RHDRSIZE);
|
bp = allocb(UDP_IPHDR + UDP_RHDRSIZE);
|
||||||
if(bp == nil)
|
|
||||||
return;
|
|
||||||
bp->wp += UDP_IPHDR + UDP_RHDRSIZE;
|
bp->wp += UDP_IPHDR + UDP_RHDRSIZE;
|
||||||
f = c->p->f;
|
f = c->p->f;
|
||||||
uh = (Udphdr *)(bp->rp);
|
uh = (Udphdr *)(bp->rp);
|
||||||
|
|
|
@ -1114,14 +1114,10 @@ htontcp4(Tcp *tcph, Block *data, Tcp4hdr *ph, Tcpctl *tcb)
|
||||||
if(data) {
|
if(data) {
|
||||||
dlen = blocklen(data);
|
dlen = blocklen(data);
|
||||||
data = padblock(data, hdrlen + TCP4_PKT);
|
data = padblock(data, hdrlen + TCP4_PKT);
|
||||||
if(data == nil)
|
|
||||||
return nil;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dlen = 0;
|
dlen = 0;
|
||||||
data = allocb(hdrlen + TCP4_PKT + 64); /* the 64 pad is to meet mintu's */
|
data = allocb(hdrlen + TCP4_PKT + 64); /* the 64 pad is to meet mintu's */
|
||||||
if(data == nil)
|
|
||||||
return nil;
|
|
||||||
data->wp += hdrlen + TCP4_PKT;
|
data->wp += hdrlen + TCP4_PKT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -242,9 +242,6 @@ udpkick(void *x, Block *bp)
|
||||||
switch(version){
|
switch(version){
|
||||||
case V4:
|
case V4:
|
||||||
bp = padblock(bp, UDP4_IPHDR_SZ+UDP_UDPHDR_SZ);
|
bp = padblock(bp, UDP4_IPHDR_SZ+UDP_UDPHDR_SZ);
|
||||||
if(bp == nil)
|
|
||||||
return;
|
|
||||||
|
|
||||||
uh4 = (Udp4hdr *)(bp->rp);
|
uh4 = (Udp4hdr *)(bp->rp);
|
||||||
ptcllen = dlen + UDP_UDPHDR_SZ;
|
ptcllen = dlen + UDP_UDPHDR_SZ;
|
||||||
uh4->Unused = 0;
|
uh4->Unused = 0;
|
||||||
|
@ -276,14 +273,11 @@ udpkick(void *x, Block *bp)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case V6:
|
case V6:
|
||||||
bp = padblock(bp, UDP6_IPHDR_SZ+UDP_UDPHDR_SZ);
|
|
||||||
if(bp == nil)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* using the v6 ip header to create pseudo header
|
* using the v6 ip header to create pseudo header
|
||||||
* first then reset it to the normal ip header
|
* first then reset it to the normal ip header
|
||||||
*/
|
*/
|
||||||
|
bp = padblock(bp, UDP6_IPHDR_SZ+UDP_UDPHDR_SZ);
|
||||||
uh6 = (Udp6hdr *)(bp->rp);
|
uh6 = (Udp6hdr *)(bp->rp);
|
||||||
memset(uh6, 0, 8);
|
memset(uh6, 0, 8);
|
||||||
ptcllen = dlen + UDP_UDPHDR_SZ;
|
ptcllen = dlen + UDP_UDPHDR_SZ;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue