4.2 UDP
RWS at MIT-XX.ARPA
RWS at MIT-XX.ARPA
Tue Nov 8 12:15:32 AEST 1983
From: Robert W. Scheifler <RWS at MIT-XX.ARPA>
My earlier UDP bug fixes were not completely wonderful. Here is my final
rewrite. In /sys/netinet/udp_usrreq.c in udp_output(), the code
ui->ui_ulen = htons((u_short)ui->ui_len);
should be changed to
ui->ui_len = htons((u_short)ui->ui_len);
ui->ui_ulen = ui->ui_len;
and the code
ui->ui_sum = in_cksum(m, sizeof (struct udpiphdr) + len)
should be changed to
if (udpcksum) {
if (!(ui->ui_sum = in_cksum(m, sizeof (struct udpiphdr) + len)))
ui->ui_sum = -1;
}
In udp_input(), the code
if (udpcksum) {
ui->ui_next = ui->ui_prev = 0;
ui->ui_x1 = 0;
ui->ui_len = htons((u_short)len);
if (ui->ui_sum = in_cksum(m, len + sizeof (struct ip))) {
udpstat.udps_badsum++;
m_freem(m);
return;
}
}
should be changed to
if (udpcksum && ui->ui_sum) {
ui->ui_next = ui->ui_prev = 0;
ui->ui_x1 = 0;
ui->ui_len = htons((u_short)len);
if (in_cksum(m, len + sizeof (struct ip))) {
udpstat.udps_badsum++;
m_freem(m);
return;
}
}
Then
int udpcksum;
can be changed to
int udpcksum = 1;
-------
More information about the Comp.unix.wizards
mailing list