version 1.1.1.2, 2013/07/22 11:54:42
|
version 1.1.1.3, 2023/09/27 11:11:38
|
Line 33
|
Line 33
|
* |
* |
*/ |
*/ |
|
|
#if (HAVE_CONFIG_H) | #include "common.h" |
#include "../include/config.h" | |
#endif | |
#if (!(_WIN32) || (__CYGWIN__)) | |
#include "../include/libnet.h" | |
#else | |
#include "../include/win32/libnet.h" | |
#endif | |
|
|
libnet_ptag_t |
libnet_ptag_t |
libnet_build_ospfv2(uint16_t len, uint8_t type, uint32_t rtr_id, |
libnet_build_ospfv2(uint16_t len, uint8_t type, uint32_t rtr_id, |
Line 108 libnet_build_ospfv2_hello(uint32_t netmask, uint16_t i
|
Line 101 libnet_build_ospfv2_hello(uint32_t netmask, uint16_t i
|
uint8_t priority, uint32_t dead_int, uint32_t des_rtr, uint32_t bkup_rtr, |
uint8_t priority, uint32_t dead_int, uint32_t des_rtr, uint32_t bkup_rtr, |
const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag) |
const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag) |
{ |
{ |
|
return libnet_build_ospfv2_hello_neighbor(netmask, interval, opts, |
|
priority, dead_int, des_rtr, bkup_rtr, 0, |
|
payload, payload_s, l, ptag); |
|
} |
|
|
|
libnet_ptag_t |
|
libnet_build_ospfv2_hello_neighbor(uint32_t netmask, uint16_t interval, uint8_t opts, |
|
uint8_t priority, uint32_t dead_int, uint32_t des_rtr, uint32_t bkup_rtr, uint32_t neighbor, |
|
const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag) |
|
{ |
uint32_t n, h; |
uint32_t n, h; |
libnet_pblock_t *p; |
libnet_pblock_t *p; |
struct libnet_ospf_hello_hdr hello_hdr; |
struct libnet_ospf_hello_hdr hello_hdr; |
|
|
if (l == NULL) |
if (l == NULL) |
{ | { |
return (-1); |
return (-1); |
} | } |
|
|
n = LIBNET_OSPF_HELLO_H + payload_s; |
n = LIBNET_OSPF_HELLO_H + payload_s; |
h = 0; |
h = 0; |
Line 129 const uint8_t *payload, uint32_t payload_s, libnet_t *
|
Line 132 const uint8_t *payload, uint32_t payload_s, libnet_t *
|
{ |
{ |
return (-1); |
return (-1); |
} |
} |
| |
memset(&hello_hdr, 0, sizeof(hello_hdr)); |
memset(&hello_hdr, 0, sizeof(hello_hdr)); |
hello_hdr.hello_nmask.s_addr = netmask; /* Netmask */ |
hello_hdr.hello_nmask.s_addr = netmask; /* Netmask */ |
hello_hdr.hello_intrvl = htons(interval); /* # seconds since last packet sent */ |
hello_hdr.hello_intrvl = htons(interval); /* # seconds since last packet sent */ |
Line 138 const uint8_t *payload, uint32_t payload_s, libnet_t *
|
Line 141 const uint8_t *payload, uint32_t payload_s, libnet_t *
|
hello_hdr.hello_dead_intvl = htonl(dead_int); /* Time til router is deemed down */ |
hello_hdr.hello_dead_intvl = htonl(dead_int); /* Time til router is deemed down */ |
hello_hdr.hello_des_rtr.s_addr = des_rtr; /* Networks designated router */ |
hello_hdr.hello_des_rtr.s_addr = des_rtr; /* Networks designated router */ |
hello_hdr.hello_bkup_rtr.s_addr = bkup_rtr; /* Networks backup router */ |
hello_hdr.hello_bkup_rtr.s_addr = bkup_rtr; /* Networks backup router */ |
/*hello_hdr.hello_nbr.s_addr = htonl(neighbor); */ | hello_hdr.hello_nbr.s_addr = htonl(neighbor); |
|
|
n = libnet_pblock_append(l, p, (uint8_t *)&hello_hdr, LIBNET_OSPF_HELLO_H); |
n = libnet_pblock_append(l, p, (uint8_t *)&hello_hdr, LIBNET_OSPF_HELLO_H); |
if (n == -1) |
if (n == -1) |
Line 148 const uint8_t *payload, uint32_t payload_s, libnet_t *
|
Line 151 const uint8_t *payload, uint32_t payload_s, libnet_t *
|
|
|
/* boilerplate payload sanity check / append macro */ |
/* boilerplate payload sanity check / append macro */ |
LIBNET_DO_PAYLOAD(l, p); |
LIBNET_DO_PAYLOAD(l, p); |
| |
return (ptag ? ptag : libnet_pblock_update(l, p, h, | return (ptag ? ptag : libnet_pblock_update(l, p, h, |
LIBNET_PBLOCK_OSPF_HELLO_H)); |
LIBNET_PBLOCK_OSPF_HELLO_H)); |
bad: |
bad: |
libnet_pblock_delete(l, p); |
libnet_pblock_delete(l, p); |
return (-1); |
return (-1); |
} |
} |
|
|
|
|
libnet_ptag_t |
libnet_ptag_t |
libnet_build_ospfv2_dbd(uint16_t dgram_len, uint8_t opts, uint8_t type, |
libnet_build_ospfv2_dbd(uint16_t dgram_len, uint8_t opts, uint8_t type, |
uint32_t seqnum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, |
uint32_t seqnum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, |
Line 208 bad:
|
Line 210 bad:
|
|
|
|
|
libnet_ptag_t |
libnet_ptag_t |
libnet_build_ospfv2_lsr(uint32_t type, uint lsid, uint32_t advrtr, | libnet_build_ospfv2_lsr(uint32_t type, uint32_t lsid, uint32_t advrtr, |
const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag) |
const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag) |
{ |
{ |
uint32_t n, h; |
uint32_t n, h; |
Line 302 bad:
|
Line 304 bad:
|
|
|
|
|
libnet_ptag_t |
libnet_ptag_t |
libnet_build_ospfv2_lsa(uint16_t age, uint8_t opts, uint8_t type, uint lsid, | libnet_build_ospfv2_lsa(uint16_t age, uint8_t opts, uint8_t type, uint32_t lsid, |
uint32_t advrtr, uint32_t seqnum, uint16_t sum, uint16_t len, |
uint32_t advrtr, uint32_t seqnum, uint16_t sum, uint16_t len, |
const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag) |
const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag) |
{ |
{ |
Line 467 bad:
|
Line 469 bad:
|
|
|
|
|
libnet_ptag_t |
libnet_ptag_t |
libnet_build_ospfv2_lsa_sum(uint32_t nmask, uint32_t metric, uint tos, | libnet_build_ospfv2_lsa_sum(uint32_t nmask, uint32_t metric, uint32_t tos, |
const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag) |
const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag) |
{ |
{ |
uint32_t n, h; |
uint32_t n, h; |
Line 516 bad:
|
Line 518 bad:
|
|
|
|
|
libnet_ptag_t |
libnet_ptag_t |
libnet_build_ospfv2_lsa_as(uint32_t nmask, uint metric, uint32_t fwdaddr, | libnet_build_ospfv2_lsa_as(uint32_t nmask, uint32_t metric, uint32_t fwdaddr, |
uint32_t tag, const uint8_t *payload, uint32_t payload_s, libnet_t *l, |
uint32_t tag, const uint8_t *payload, uint32_t payload_s, libnet_t *l, |
libnet_ptag_t ptag) |
libnet_ptag_t ptag) |
{ |
{ |
Line 565 bad:
|
Line 567 bad:
|
return (-1); |
return (-1); |
} |
} |
|
|
/* EOF */ | /** |
| * Local Variables: |
| * indent-tabs-mode: nil |
| * c-file-style: "stroustrup" |
| * End: |
| */ |