Skip to content

Commit eba6105

Browse files
feat: implement support carp unicast mode (plus only) #424
1 parent 7b5a9f7 commit eba6105

File tree

1 file changed

+16
-0
lines changed
  • pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models

1 file changed

+16
-0
lines changed

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models/VirtualIP.inc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class VirtualIP extends Model {
3131
public IntegerField $advskew;
3232
public StringField $password;
3333
public StringField $carp_status;
34+
public StringField $carp_mode;
35+
public StringField $carp_peer;
3436

3537
public function __construct(mixed $id = null, mixed $parent_id = null, mixed $data = [], mixed ...$options) {
3638
# Define model attributes
@@ -122,6 +124,20 @@ class VirtualIP extends Model {
122124
help_text: 'The current CARP status of this virtual IP. This will display show whether this CARP node ' .
123125
'is the primary or backup peer.',
124126
);
127+
$this->carp_mode = new StringField(
128+
default: 'mcast',
129+
choices: ['mcast', 'ucast'],
130+
conditions: ['mode' => 'carp'],
131+
help_text: 'The CARP mode to use for this virtual IP. Please note this field is exclusive to ' .
132+
'pfSense Plus and has no effect on CE.',
133+
);
134+
$this->carp_peer = new StringField(
135+
required: true,
136+
conditions: ['carp_mode' => 'ucast'],
137+
validators: [new IPAddressValidator(allow_ipv4: true, allow_ipv6: true)],
138+
help_text: 'The IP address of the CARP peer. Please note this field is exclusive to pfSense Plus and ' .
139+
'has no effect on CE.',
140+
);
125141

126142
parent::__construct($id, $parent_id, $data, ...$options);
127143
}

0 commit comments

Comments
 (0)