diff options
| author | Roy Marples <roy@marples.name> | 2008-01-09 13:41:16 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-01-09 13:41:16 +0000 |
| commit | 8585e629ee347011937635d92b7e99743cdffd7a (patch) | |
| tree | 343011c2d88102e9a3c4b42dc1596cafc01b626d /arp.c | |
| parent | be37cc89a16b15988b7860e7779bc208f81c3491 (diff) | |
| download | dhcpcd-8585e629ee347011937635d92b7e99743cdffd7a.tar.xz | |
Disallow arp claim for IEEE1394 per RFC 2734 thanks to pawka.
Diffstat (limited to 'arp.c')
| -rw-r--r-- | arp.c | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -80,6 +80,7 @@ static int send_arp (const interface_t *iface, int op, struct in_addr sip, { struct arphdr *arp; int arpsize = arphdr_len2 (iface->hwlen, sizeof (struct in_addr)); + char *tha; int retval; arp = xmalloc (arpsize); @@ -92,8 +93,16 @@ static int send_arp (const interface_t *iface, int op, struct in_addr sip, arp->ar_op = htons (op); memcpy (ar_sha (arp), iface->hwaddr, arp->ar_hln); memcpy (ar_spa (arp), &sip, arp->ar_pln); - if (taddr) - memcpy (ar_tha (arp), taddr, arp->ar_hln); + if (taddr) { + /* NetBSD can return NULL from ar_tha, which is probably wrong + * but we still need to deal with it */ + if (! (tha = ar_tha (arp))) { + free (arp); + errno = EINVAL; + return (-1); + } + memcpy (tha, taddr, arp->ar_hln); + } memcpy (ar_tpa (arp), &tip, arp->ar_pln); retval = send_packet (iface, ETHERTYPE_ARP, @@ -173,6 +182,12 @@ int arp_claim (interface_t *iface, struct in_addr address) if (send_arp (iface, ARPOP_REQUEST, null_address, NULL, address) == -1) break; + + /* IEEE1394 cannot set ARP target address + * according to RFC2734 */ + if (nprobes >= NPROBES && + iface->family == ARPHRD_IEEE1394) + nclaims = NCLAIMS; } else if (nclaims < NCLAIMS) { nclaims ++; timeout = CLAIM_INTERVAL; |
