APPLIED: Lucid/Maverick/Oneiric SRU, relax AF_INET check in bind()

Tim Gardner tim.gardner at canonical.com
Tue Dec 6 14:05:57 UTC 2011


On 12/05/2011 11:46 AM, Herton R. Krzesinski wrote:
> SRU Justification
>
> Impact
> bind(AF_UNSPEC) to INADDR_ANY doesn't work anymore, breaking some legacy
> applications, since commit d0733d2e29b65 (Check for mistakenly passed in
> non-IPv4 address)
>
> Fix
> upstream commit 29c486df6a208432b370bd4be99ae1369ede28d8
>
> Testcase
> #include<stdio.h>
> #include<sys/socket.h>
> #include<string.h>
> #include<linux/in.h>
>
> int main(int argc, char **argv)
> {
>   struct sockaddr_in addr;
>   int fd, r;
>
>   fd = socket(PF_INET, SOCK_STREAM, 0);
>   memset(&addr, 0, sizeof(struct sockaddr_in));
>   r = bind(fd, (struct sockaddr *)&addr, sizeof(addr));
>   if (!r)
>    printf("Everything looks good\n");
>   else
>    printf("ERROR: too strict AF_INET check\n");
>   close(fd);
> }
>


-- 
Tim Gardner tim.gardner at canonical.com




More information about the kernel-team mailing list