mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-23 02:01:55 +00:00
2ce8589753
Changes: - Remove -R command line option (it's automatic, system dependent) - Fix mixing of broadcast and binding - Add -c command line option for count of packet - Fix receiving broadcast - Scan all interfaces via device protocol (unfortunately it is ugly)
48 lines
718 B
C
48 lines
718 B
C
#include "common.h"
|
|
|
|
int
|
|
do_sendmsg(sock *s, void *pkt, size_t len)
|
|
{
|
|
memcpy(s->ttx, pkt, len);
|
|
s->tpos = s->ttx + len;
|
|
|
|
if (cf_count && ++counter > cf_count)
|
|
exit(0);
|
|
|
|
return sk_write(s);
|
|
}
|
|
|
|
void
|
|
connected_hook(sock *s)
|
|
{
|
|
printf("Start sending...\n");
|
|
s->tx_hook = NULL;
|
|
}
|
|
|
|
int
|
|
main(int argc, char *argv[])
|
|
{
|
|
bird_init();
|
|
|
|
sock *s = skt_parse_args(argc, argv, 1);
|
|
s->tx_hook = connected_hook;
|
|
s->tbsize = 1500;
|
|
s->tos = IP_PREC_INTERNET_CONTROL;
|
|
|
|
skt_open(s);
|
|
|
|
struct my_packet pkt = {
|
|
.magic = htonl(PKT_MAGIC),
|
|
.value = htonl(cf_value),
|
|
};
|
|
|
|
int count = 0;
|
|
while (1)
|
|
{
|
|
pkt.count = htonl(++count);
|
|
do_sendmsg(s, &pkt, sizeof(pkt));
|
|
|
|
usleep(200000);
|
|
}
|
|
}
|