|
|
| version 1.2, 2011/10/17 20:14:02 | version 1.2.2.1, 2011/10/31 09:46:18 |
|---|---|
| Line 133 PrepareL3(const struct sockaddr *sa, int *bpflen) | Line 133 PrepareL3(const struct sockaddr *sa, int *bpflen) |
| int h, n = 1; | int h, n = 1; |
| FTRACE(3); | FTRACE(3); |
| assert(sa); | |
| h = socket(sa->sa_family, SOCK_RAW, IPPROTO_ICMP); | h = socket(sa->sa_family, SOCK_RAW, IPPROTO_ICMP); |
| if (h == -1) { | if (h == -1) { |
| Line 147 PrepareL3(const struct sockaddr *sa, int *bpflen) | Line 146 PrepareL3(const struct sockaddr *sa, int *bpflen) |
| return -1; | return -1; |
| } | } |
| */ | */ |
| if (bind(h, sa, sizeof(struct sockaddr)) == -1) { | if (sa && bind(h, sa, sizeof(struct sockaddr)) == -1) { |
| printf("Error:: Cant bind to raw socket #%d - %s\n", errno, strerror(errno)); | printf("Error:: Cant bind to raw socket #%d - %s\n", errno, strerror(errno)); |
| close(h); | close(h); |
| return -1; | return -1; |