summaryrefslogtreecommitdiffstats
path: root/l10n/cy_GB.json
blob: 7b3bfbc8de61b9e69675265514f573c228a6753b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{ "translations": {
    "Download" : "Llwytho i lawr",
    "Close" : "Cau",
    "Share" : "Rhannu",
    "Username" : "Enw defnyddiwr",
    "by" : "gan",
    "from" : "oddi wrth",
    "Description" : "Disgrifiad",
    "Refresh" : "Adnewyddu",
    "Subscribe" : "Tanysgrifio",
    "Web address" : "Cyfeiriad gwe",
    "Folder" : "Plygell",
    "New folder" : "Ffolder newydd",
    "Go back" : "Nôl",
    "Credentials" : "Credentials",
    "Password" : "Cyfrinair",
    "Create" : "Creu",
    "Rename" : "Ailenwi",
    "Mark read" : "Marcio wedi'i ddarllen",
    "Newest first" : "Diweddaraf gyntaf",
    "Oldest first" : "Hynaf gyntaf",
    "Delete" : "Dileu",
    "Settings" : "Gosodiadau",
    "Import" : "Mewnforio",
    "Export" : "Allforio",
    "Help" : "Cymorth",
    "Keyboard shortcuts" : "Llwybrau byr bysellfwrdd",
    "Documentation" : "Dogfennaeth"
},"pluralForm" :"nplurals=4; plural=(n==1) ? 0 : (n==2) ? 1 : (n != 8 && n != 11) ? 2 : 3;"
}
n398'>398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627
// SPDX-License-Identifier: GPL-3.0-or-later

#include "plugin_freebsd.h"

#include <ifaddrs.h>

struct cgroup_network_interface {
    char *name;
    uint32_t hash;
    size_t len;

    // flags
    int configured;
    int enabled;
    int updated;

    int do_bandwidth;
    int do_packets;
    int do_errors;
    int do_drops;
    int do_events;

    // charts and dimensions

    RRDSET *st_bandwidth;
    RRDDIM *rd_bandwidth_in;
    RRDDIM *rd_bandwidth_out;

    RRDSET *st_packets;
    RRDDIM *rd_packets_in;
    RRDDIM *rd_packets_out;
    RRDDIM *rd_packets_m_in;
    RRDDIM *rd_packets_m_out;

    RRDSET *st_errors;
    RRDDIM *rd_errors_in;
    RRDDIM *rd_errors_out;

    RRDSET *st_drops;
    RRDDIM *rd_drops_in;
    RRDDIM *rd_drops_out;

    RRDSET *st_events;
    RRDDIM *rd_events_coll;

    struct cgroup_network_interface *next;
};

static struct cgroup_network_interface *network_interfaces_root = NULL, *network_interfaces_last_used = NULL;

static size_t network_interfaces_added = 0, network_interfaces_found = 0;

static void network_interface_free(struct cgroup_network_interface *ifm) {
    if (likely(ifm->st_bandwidth))
        rrdset_is_obsolete(ifm->st_bandwidth);
    if (likely(ifm->st_packets))
        rrdset_is_obsolete(ifm->st_packets);
    if (likely(ifm->st_errors))
        rrdset_is_obsolete(ifm->st_errors);
    if (likely(ifm->st_drops))
        rrdset_is_obsolete(ifm->st_drops);
    if (likely(ifm->st_events))
        rrdset_is_obsolete(ifm->st_events);

    network_interfaces_added--;
    freez(ifm->name);
    freez(ifm);
}

static void network_interfaces_cleanup() {
    if (likely(network_interfaces_found == network_interfaces_added)) return;

    struct cgroup_network_interface *ifm = network_interfaces_root, *last = NULL;
    while(ifm) {
        if (unlikely(!ifm->updated)) {
            // info("Removing network interface '%s', linked after '%s'", ifm->name, last?last->name:"ROOT");

            if (network_interfaces_last_used == ifm)
                network_interfaces_last_used = last;

            struct cgroup_network_interface *t = ifm;

            if (ifm == network_interfaces_root || !last)
                network_interfaces_root = ifm = ifm->next;

            else
                last->next = ifm = ifm->next;

            t->next = NULL;
            network_interface_free(t);
        }
        else {
            last = ifm;
            ifm->updated = 0;
            ifm = ifm->next;
        }
    }
}

static struct cgroup_network_interface *get_network_interface(const char *name) {
    struct cgroup_network_interface *ifm;

    uint32_t hash = simple_hash(name);

    // search it, from the last position to the end
    for(ifm = network_interfaces_last_used ; ifm ; ifm = ifm->next) {
        if (unlikely(hash == ifm->hash && !strcmp(name, ifm->name))) {
            network_interfaces_last_used = ifm->next;
            return ifm;
        }
    }

    // search it from the beginning to the last position we used
    for(ifm = network_interfaces_root ; ifm != network_interfaces_last_used ; ifm = ifm->next) {
        if (unlikely(hash == ifm->hash && !strcmp(name, ifm->name))) {
            network_interfaces_last_used = ifm->next;
            return ifm;
        }
    }

    // create a new one
    ifm = callocz(1, sizeof(struct cgroup_network_interface));
    ifm->name = strdupz(name);
    ifm->hash = simple_hash(ifm->name);
    ifm->len = strlen(ifm->name);
    network_interfaces_added++;

    // link it to the end
    if (network_interfaces_root) {
        struct cgroup_network_interface *e;
        for(e = network_interfaces_root; e->next ; e = e->next) ;
        e->next = ifm;
    }
    else
        network_interfaces_root = ifm;

    return ifm;
}

// --------------------------------------------------------------------------------------------------------------------
// getifaddrs

int do_getifaddrs(int update_every, usec_t dt) {
    (void)dt;

#define DEFAULT_EXCLUDED_INTERFACES "lo*"
#define DEFAULT_PHYSICAL_INTERFACES "igb* ix* cxl* em* ixl* ixlv* bge* ixgbe* vtnet* vmx* re* igc* dwc*"
#define CONFIG_SECTION_GETIFADDRS "plugin:freebsd:getifaddrs"

    static int enable_new_interfaces = -1;
    static int do_bandwidth_ipv4 = -1, do_bandwidth_ipv6 = -1, do_bandwidth = -1, do_packets = -1, do_bandwidth_net = -1, do_packets_net = -1,
            do_errors = -1, do_drops = -1, do_events = -1;
    static SIMPLE_PATTERN *excluded_interfaces = NULL, *physical_interfaces = NULL;

    if (unlikely(enable_new_interfaces == -1)) {
        enable_new_interfaces = config_get_boolean_ondemand(CONFIG_SECTION_GETIFADDRS,
                                                              "enable new interfaces detected at runtime",
                                                              CONFIG_BOOLEAN_AUTO);

        do_bandwidth_net  = config_get_boolean_ondemand(CONFIG_SECTION_GETIFADDRS, "total bandwidth for physical interfaces",
                                                       CONFIG_BOOLEAN_AUTO);
        do_packets_net    = config_get_boolean_ondemand(CONFIG_SECTION_GETIFADDRS, "total packets for physical interfaces",
                                                       CONFIG_BOOLEAN_AUTO);
        do_bandwidth_ipv4 = config_get_boolean_ondemand(CONFIG_SECTION_GETIFADDRS, "total bandwidth for ipv4 interfaces",
                                                        CONFIG_BOOLEAN_AUTO);
        do_bandwidth_ipv6 = config_get_boolean_ondemand(CONFIG_SECTION_GETIFADDRS, "total bandwidth for ipv6 interfaces",
                                                        CONFIG_BOOLEAN_AUTO);
        do_bandwidth      = config_get_boolean_ondemand(CONFIG_SECTION_GETIFADDRS, "bandwidth for all interfaces",
                                                        CONFIG_BOOLEAN_AUTO);
        do_packets        = config_get_boolean_ondemand(CONFIG_SECTION_GETIFADDRS, "packets for all interfaces",
                                                        CONFIG_BOOLEAN_AUTO);
        do_errors         = config_get_boolean_ondemand(CONFIG_SECTION_GETIFADDRS, "errors for all interfaces",
                                                        CONFIG_BOOLEAN_AUTO);
        do_drops          = config_get_boolean_ondemand(CONFIG_SECTION_GETIFADDRS, "drops for all interfaces",
                                                        CONFIG_BOOLEAN_AUTO);
        do_events         = config_get_boolean_ondemand(CONFIG_SECTION_GETIFADDRS, "collisions for all interfaces",
                                                        CONFIG_BOOLEAN_AUTO</